creode / magic-login

A Magic Link plugin which sits on top of the existing user sign in and registration process.
Other
3 stars 2 forks source link

Using useEmailAsUsername = true silent fails when it should show error messages in the signup/register template #24

Open zizther opened 1 year ago

zizther commented 1 year ago

When setting useEmailAsUsername to true in the general.php config file to enable users to control their username within a site requires the signup form to have a username field, if not and you try to submit the signup/register form with just an email address the form does not show any error messages and fails silently, it is only reported in the logs. The form submits as it would if it were successful and redirects the user to the confirmation route, when it should not redirect and show the error messages.

Additionally if there are any custom validation rules added via a custom module for the username, these validation errors are not output in the signup/register form, these fails silently as well meaning the above scenario repeats.

It would be good for the signup form to take into account error messages and custom validation rules for elements such as usernames and passwords, with the appropriate error messages being output in the template.

jaymeh commented 1 year ago

@zizther Good point, lot of stuff to be tested with this, we built this plugin around a single website and tailored it to that specific use case. I'll review it when I get some time (hopefully next week) and try to figure out a solution.

Thanks again!

jaymeh commented 1 week ago

@zizther I've added a potential fix in the attached Pull request. Let me know if this is what you had in mind?

Thanks