mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Setting up after_login redirects
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
Darkswarm.controller "LoginCtrl", ($scope, $http, $location, AuthenticationService) ->
|
||||
Darkswarm.controller "LoginCtrl", ($scope, $http, AuthenticationService, Redirections) ->
|
||||
$scope.path = "/login"
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).success (data)->
|
||||
location.href = location.origin + location.pathname # Strips out hash fragments
|
||||
if Redirections.after_login
|
||||
location.href = location.origin + Redirections.after_login
|
||||
else
|
||||
location.href = location.origin + location.pathname # Strips out hash fragments
|
||||
.error (data) ->
|
||||
$scope.errors = data.message
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location)->
|
||||
Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redirections)->
|
||||
new class AuthenticationService
|
||||
selectedPath: "/login"
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Darkswarm.factory "Redirections", ($location)->
|
||||
new class Redirections
|
||||
after_login: $location.search().after_login
|
||||
Reference in New Issue
Block a user