Login - Custom Error Message if Email Unverified

Is it possible to set a custom authMessage if a user tries to log in but their email is not verified?

I don’t see this in the helper file anywhere, and the current solution returns a generic “Invalid Login”. I think it would be more informative to tell the user the issue is not an invalid login, but rather an unverified email.

Is this possible?

The auth messages are returned by the cloud, so currently not customizable.
But, you can do this, however:

Since its just data and JS, you can check for a key word in the error and show what ever.

Wanted to further document for future travelers, as this question has come up recently.

The auth messages that get returned can be retrieved from the model with model.authMessage.

So where you would display model.authMessage normally, you can add a conditional to show different messages depending on the authMessage returned.

For example, if the authMessage is email@email.com - account disabled and you wanted to show a different message for that case, in your HTML you can do:
{{model.authMessage.includes('account disabled') ? 'Account under processing validation' : model.authMessage}}

This code checks if authMessage contains a specific string. If it does, it shows the message after the question mark (?). If it doesn’t it will show the message after the colon ( : ).

Furthermore, you can chain these conditional checks if you wanted a different message for multiple authMessages:
{{model.authMessage.includes('account disabled') ? 'Account under processing validation' : model.authMessage.includes('Invalid login') ? 'Invalid Credentials' : model.authMessage}}

1 Like