Catch error when User Creation Email fails at UserCreationService #5119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the current 1.x release of Pterodactyl, when a Pterodactyl instance doesn't have emails configured or email details are invalid, administrative users are given a '500 Error' screen when creating a user rather than being shown the successfully created user's details page.
In this PR, I've simply caught the error and logged it. Opting not to display the error to the user, the user is then redirected to the successfully created user screen. There are many instances where emails aren't configured and the instance administrator is aware, so it makes sense not to hinder the user creation sequence.
I did consider returning an email sent successful state as part of the UserCreationService#handle, to then forward onto the user along with the new user object, however I was unsure if it would cause any major conflicts with forks or some project-specific software design choices I am unaware of.
I was thinking something similar to this if I were to return the error with the user object: https://hastebin.com/share/hamifisihe.php
Any feedback welcome. :)