mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
26 lines
698 B
CoffeeScript
26 lines
698 B
CoffeeScript
Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redirections)->
|
|
new class AuthenticationService
|
|
selectedPath: "/login"
|
|
|
|
constructor: ->
|
|
if $location.path() in ["/login", "/signup", "/forgot"]
|
|
@open()
|
|
|
|
open: (path = false)=>
|
|
@modalInstance = $modal.open
|
|
templateUrl: 'authentication.html'
|
|
windowClass: "login-modal medium"
|
|
@modalInstance.result.then @close, @close
|
|
@selectedPath = path || @selectedPath
|
|
Navigation.navigate @selectedPath
|
|
|
|
|
|
select: (path)=>
|
|
@selectedPath = path
|
|
Navigation.navigate @selectedPath
|
|
|
|
active: Navigation.active
|
|
|
|
close: ->
|
|
Navigation.navigate "/"
|