From d7d3cbe5054229f2f668a80bb329bb1148ad5e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 9 Jul 2014 13:53:59 +0200 Subject: [PATCH] Add success and error messages to the auth directives --- app/coffee/modules/auth.coffee | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 2a7772d7..c9b416c9 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -162,10 +162,12 @@ LoginDirective = ($auth, $confirm, $location) -> promise.then (response) -> # TODO: finish this. Go tu user home page $location.path("/project/project-example-0/backlog") - # + promise.then null, (response) -> if response.data._error_message - $confirm.notify("light-error", response.data._error_message) + $confirm.notify("light-error", "According to our Oompa Loompas, + your username/email or password + are incorrect.") #TODO: i18n $el.on "submit", (event) -> event.preventDefault() @@ -195,13 +197,13 @@ RegisterDirective = ($auth, $confirm) -> promise = $auth.publicRegister($scope.data) promise.then (response) -> # TODO: finish this. Authenticate user and go to projects page - #$confirm.notify("success", response.data.detail) console.log response - # promise.then null, (response) -> if response.data._error_message - $confirm.notify("light-error", response.data._error_message) + $confirm.notify("light-error", "According to our Oompa Loompas, + your are not registered yet or + type an invalid password.") #TODO: i18n $el.on "submit", (event) -> event.preventDefault() @@ -231,11 +233,15 @@ ForgotPasswordDirective = ($auth, $confirm, $location) -> promise.then (response) -> if response.data.detail $location.path("/login") # TODO: Use the future 'urls' service - $confirm.success(response.data.detail) + $confirm.success("Check your inbox!
+ We have sent a mail to
+ #{data.email}
+ with the instructions to set a new password") #TODO: i18n promise.then null, (response) -> if response.data._error_message - $confirm.notify("light-error", response.data._error_message) + $confirm.notify("light-error", "According to our Oompa Loompas, + your are not registered yet.") #TODO: i18n $el.on "submit", (event) -> event.preventDefault()