Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank user alert on account creation, when UF5 can't connect to SMTP #1229

Closed
StrykeSlammerII opened this issue Oct 31, 2023 · 1 comment
Closed
Assignees
Labels
confirmed bug Something isn't working V5
Milestone

Comments

@StrykeSlammerII
Copy link

StrykeSlammerII commented Oct 31, 2023

Version and OS: UF 5, native install, Firefox, Linux (Arch)

PROBLEM:
When a new user attempts to create an account, but UF can't connect to an SMTP server, the user receives a blank alert popup.
(The user is still created.)
image

EXPECTED RESULTS:
A blank error message is unhelpful.
At least it could alert the user that there is an issue with the webpage and the account was not created.

In my test, app/logs/userfrosting.log showed successful DB queries, but UF could not connect to SMTP server:

[2023-10-31T01:50:59.474993-04:00] mail.DEBUG: Connection failed. Error #2: stream_socket_client(): Unable to connect to 0.0.0.0:1025 (Connection refused) [/home/strike/Frosting/UF5-native/vendor/phpmailer/phpmailer/src/SMTP.php line 396] [] []
[2023-10-31T01:50:59.475037-04:00] mail.DEBUG: SMTP ERROR: Failed to connect to server: Connection refused (111) [] []
[2023-10-31T01:50:59.484563-04:00] mail.DEBUG: SMTP Error: Could not connect to SMTP host. Failed to connect to server [] []
[2023-10-31T01:50:59.485549-04:00] errors.ERROR: UserFrosting Application Error:
Type: PHPMailer\PHPMailer\Exception
Message: SMTP Error: Could not connect to SMTP host. Failed to connect to server
File: /home/strike/Frosting/UF5-native/vendor/phpmailer/phpmailer/src/PHPMailer.php
Line: 2233
Trace: #0 /home/strike/Frosting/UF5-native/vendor/phpmailer/phpmailer/src/PHPMailer.php(2019): PHPMailer\PHPMailer\PHPMailer->smtpConnect()
[etc]

Root user can't see the new account via the web interface. I have not been able to check the database directly to see whether a partial account exists there.

(In my case the SMTP server was not running, so everything aside from the empty user alert appears to be correct.)

@lcharette
Copy link
Member

I added a try/catch to catch PHPMailerException and add a proper warning in userfrosting/sprinkle-account@836a3a2.

It's a "temporary" solution, as the actual warning is already returned in the request body, but not properly handled by uf-form.js. By default _debugAjax is off and the exception doesn't have a description (but it doesn't matter, since _debugAjax is off), so nothing was displayed. The whole ufForm need to be rewritten, and it's planned for UF6 with Vue.js, so I won' waste more time on this for now and went with this "temp" fix.

@lcharette lcharette moved this from Done (5.1) to Done in UserFrosting Task Planner Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Something isn't working V5
Projects
Status: Done
Development

No branches or pull requests

2 participants