show the back error message and set it inline if it is needed

stable
Juanfran 2015-06-16 15:18:08 +02:00 committed by David Barragán Merino
parent e29ec15101
commit e6cf655388
2 changed files with 8 additions and 9 deletions

View File

@ -260,9 +260,9 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $analytics,
$location.path($navUrls.resolve("home"))
onErrorSubmit = (response) ->
if response.data._error_message?
text = $translate.instant("LOGIN_FORM.ERROR_GENERIC") + " " + response.data._error_message
$confirm.notify("light-error", text + " " + response.data._error_message)
if response.data._error_message
text = $translate.instant("COMMON.GENERIC_ERROR", {error: response.data._error_message})
$confirm.notify("light-error", text)
form.setErrors(response.data)
@ -350,12 +350,10 @@ ChangePasswordFromRecoveryDirective = ($auth, $confirm, $location, $params, $nav
$location.path($navUrls.resolve("login"))
text = $translate.instant("CHANGE_PASSWORD_RECOVERY_FORM.SUCCESS")
$confirm.success(text)
onErrorSubmit = (response) ->
text = $translate.instant("COMMON.GENERIC_ERROR", {error: response.data._error_message})
$confirm.notify("light-error", text)
submit = debounce 2000, (event) =>
@ -429,7 +427,7 @@ InvitationDirective = ($auth, $confirm, $location, $params, $navUrls, $analytics
# Register form
$scope.dataRegister = {token: token}
registerForm = $el.find("form.register-form").checksley()
registerForm = $el.find("form.register-form").checksley({onlyOneErrorElement: true})
onSuccessSubmitRegister = (response) ->
$analytics.trackEvent("auth", "invitationAccept", "invitation accept with new user", 1)
@ -438,10 +436,12 @@ InvitationDirective = ($auth, $confirm, $location, $params, $navUrls, $analytics
"Welcome to #{_.escape($scope.invitation.project_name)}")
onErrorSubmitRegister = (response) ->
text = $translate.instant("LOGIN_FORM.ERROR_AUTH_INCORRECT")
if response.data._error_message
text = $translate.instant("COMMON.GENERIC_ERROR", {error: response.data._error_message})
$confirm.notify("light-error", text)
registerForm.setErrors(response.data)
submitRegister = debounce 2000, (event) =>
event.preventDefault()

View File

@ -263,7 +263,6 @@
},
"LOGIN_FORM": {
"ERROR_AUTH_INCORRECT": "According to our Oompa Loompas, your username/email or password are incorrect.",
"ERROR_GENERIC": "According to our Oompa Loompas there was an error.",
"SUCCESS": "Our Oompa Loompas are happy, welcome to Taiga."
},
"REGISTER": {