From c231bb75755b678bd02b70c2978ded7164cf2aea Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 12 Jun 2015 08:50:49 +0200 Subject: [PATCH] Now anonymous users can confirm the change of email even if they are not authenticated, some users update the email from a desktop browser but check the email from mobile --- app/coffee/modules/auth.coffee | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index eeb45a84..b296d286 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -474,12 +474,15 @@ ChangeEmailDirective = ($repo, $model, $auth, $confirm, $location, $params, $nav form = $el.find("form").checksley() onSuccessSubmit = (response) -> - $repo.queryOne("users", $auth.getUser().id).then (data) => - $auth.setUser(data) - $location.path($navUrls.resolve("home")) + if $auth.isAuthenticated() + $repo.queryOne("users", $auth.getUser().id).then (data) => + $auth.setUser(data) + $location.path($navUrls.resolve("home")) + else + $location.path($navUrls.resolve("login")) - text = $translate.instant("CHANGE_EMAIL_FORM.SUCCESS") - $confirm.success(text) + text = $translate.instant("CHANGE_EMAIL_FORM.SUCCESS") + $confirm.success(text) onErrorSubmit = (response) -> text = $translate.instant("COMMON.GENERIC_ERROR", {error: response.data._error_message})