diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index a105003c..91d2437f 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -153,21 +153,16 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls) - $scope.data = {} onSuccessSubmit = (response) -> - # NOTE: Hack to remember the login form values - form = $el.find("form") - - form.attr("method", "POST") if $routeParams['next'] and $routeParams['next'] != $navUrls.resolve("login") - form.attr("action", $routeParams['next']) + nextUrl = $routeParams['next'] else - form.attr("action", $navUrls.resolve("home")) + nextUrl = $navUrls.resolve("home") - form.submit() + $location.path(nextUrl) onErrorSubmit = (response) -> $confirm.notify("light-error", "According to our Oompa Loompas, your username/email or password are incorrect.") #TODO: i18n - submit = -> form = $el.find("form").checksley() if not form.validate() @@ -180,6 +175,10 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls) - event.preventDefault() submit() + $el.on "submit", "form", (event) -> + event.preventDefault() + submit() + return {link:link} module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$location", "$tgConfig", "$routeParams", "$tgNavUrls",