Ensure email links return to proper path on private shops, refactor modal logic

This commit is contained in:
Matt-Yorkley
2018-03-03 16:30:24 +00:00
committed by Maikel Linke
parent ea9b0eca48
commit e6bdbccffa

View File

@@ -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