Skip to content
Snippets Groups Projects
Commit bf90425e authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Show error if email already exists in signup

parent 1df22f9a
No related branches found
No related tags found
No related merge requests found
...@@ -61,8 +61,16 @@ Template.loginForm.events ...@@ -61,8 +61,16 @@ Template.loginForm.events
return return
if instance.state.get() is 'register' if instance.state.get() is 'register'
Meteor.call 'registerUser', formData, (err, result) -> Meteor.call 'registerUser', formData, (error, result) ->
RocketChat.Button.reset(button) RocketChat.Button.reset(button)
if error?
if error.error is 'Email already exists.'
toastr.error t 'Email_already_exists'
else
toastr.error error.reason
return
Meteor.loginWithPassword formData.email, formData.pass, (error) -> Meteor.loginWithPassword formData.email, formData.pass, (error) ->
if error?.error is 'no-valid-email' if error?.error is 'no-valid-email'
toastr.success t('We_have_sent_registration_email') toastr.success t('We_have_sent_registration_email')
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
"edited" : "edited", "edited" : "edited",
"Email_or_username" : "Email or username", "Email_or_username" : "Email or username",
"Email_verified" : "Email verified", "Email_verified" : "Email verified",
"Email_already_exists": "Email already exists",
"Enter_info" : "Enter your login information", "Enter_info" : "Enter your login information",
"Error_changing_password" : "Password changed", "Error_changing_password" : "Password changed",
"Favorites" : "Favorites", "Favorites" : "Favorites",
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
"edited" : "editado", "edited" : "editado",
"Email_or_username" : "Email ou nome de usuário", "Email_or_username" : "Email ou nome de usuário",
"Email_verified" : "Email verificado", "Email_verified" : "Email verificado",
"Email_already_exists": "Email já cadastrado",
"Enter_info" : "Entre com seus dados de login", "Enter_info" : "Entre com seus dados de login",
"Error_changing_password" : "Senha alterada", "Error_changing_password" : "Senha alterada",
"Favorites" : "Favoritos", "Favorites" : "Favoritos",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment