diff --git a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee b/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee index 8a52f8e92b..96d52d566b 100644 --- a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee +++ b/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee @@ -4,13 +4,8 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir selectedPath: "/login" constructor: -> - if $location.path() in ["/login", "/signup", "/forgot"] && location.pathname isnt '/register/auth' - @open $location.path() - else if location.pathname is '/register/auth' - if angular.isDefined($location.search()['validation']) - @open '/login', 'registration_authentication.html' - else - @open '/signup', 'registration_authentication.html' + if $location.path() in ["/login", "/signup", "/forgot"] || location.pathname is '/register/auth' + @open @initialTab(), @initialTemplate() open: (path = false, template = 'authentication.html') => @modalInstance = $modal.open @@ -20,6 +15,19 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir @selectedPath = path || @selectedPath Navigation.navigate @selectedPath + initialTab: -> + if angular.isDefined($location.search()['validation']) + '/login' + else if location.pathname is '/register/auth' + '/signup' + else + $location.path() + + initialTemplate: -> + if location.pathname is '/register/auth' + 'registration_authentication.html' + else + 'authentication.html' select: (path)=> @selectedPath = path