mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Getting signup to work and authentication to load in reg specific template
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "SignupCtrl", ($scope, $http, $location, AuthenticationService) ->
|
||||
Darkswarm.controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) ->
|
||||
$scope.path = "/signup"
|
||||
$scope.errors =
|
||||
email: null
|
||||
@@ -6,6 +6,9 @@ Darkswarm.controller "SignupCtrl", ($scope, $http, $location, AuthenticationServ
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)->
|
||||
location.href = location.origin + location.pathname # Strips out hash fragments
|
||||
if Redirections.after_login
|
||||
$window.location.href = $window.location.origin + Redirections.after_login
|
||||
else
|
||||
$window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments
|
||||
.error (data) ->
|
||||
$scope.errors = data
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Darkswarm.controller "AuthenticationCtrl", ($scope, AuthenticationService, SpreeUser)->
|
||||
$scope.open = AuthenticationService.open
|
||||
$scope.toggle = AuthenticationService.toggle
|
||||
|
||||
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.active = AuthenticationService.active
|
||||
$scope.select = AuthenticationService.select
|
||||
|
||||
@@ -4,12 +4,14 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir
|
||||
selectedPath: "/login"
|
||||
|
||||
constructor: ->
|
||||
if $location.path() in ["/login", "/signup", "/forgot"]
|
||||
@open()
|
||||
if $location.path() in ["/login", "/signup", "/forgot"] && location.pathname is not '/register/auth'
|
||||
@open $location.path()
|
||||
else if location.pathname is '/register/auth'
|
||||
@open '/signup', 'registration_authentication.html'
|
||||
|
||||
open: (path = false)=>
|
||||
open: (path = false, template = 'authentication.html') =>
|
||||
@modalInstance = $modal.open
|
||||
templateUrl: 'authentication.html'
|
||||
templateUrl: template
|
||||
windowClass: "login-modal medium"
|
||||
@modalInstance.result.then @close, @close
|
||||
@selectedPath = path || @selectedPath
|
||||
|
||||
@@ -14,7 +14,7 @@ Darkswarm.factory "RegistrationService", (Navigation, $modal, Loading)->
|
||||
|
||||
select: (step)=>
|
||||
@current_step = step
|
||||
|
||||
|
||||
currentStep: =>
|
||||
@current_step
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
%ofn-inline-flash.turquoise.small-12.columns{ ng: { show: 'visible' } }
|
||||
%i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } }
|
||||
{{ enterprise.name }} has been created on the Open Food Network. If you leave at any point from here onwards, your enterprise will be saved, and you can always login to the admin section to update or continue filling out your enterprise details.
|
||||
%ofn-inline-flash.brick.small-12.columns{ ng: { show: 'visible' } }
|
||||
%i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } }
|
||||
{{ enterprise.name }} won't be visible on the Open Food Network until you enter a long and short description.
|
||||
-# %ofn-inline-flash.brick.small-12.columns{ ng: { show: 'visible' } }
|
||||
-# %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } }
|
||||
-# {{ enterprise.name }} won't be visible on the Open Food Network until you enter a long and short description.
|
||||
|
||||
.small-12.large-8.columns
|
||||
.row
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
.container
|
||||
.row.modal-centered
|
||||
%h2 Welcome to the Open Food Network!
|
||||
%h5 Start By Signing Up (or logging in):
|
||||
%div{"ng-controller" => "AuthenticationCtrl"}
|
||||
%tabset
|
||||
%ng-include{src: "'signup.html'"}
|
||||
%ng-include{src: "'login.html'"}
|
||||
%ng-include{src: "'forgot.html'"}
|
||||
%div{ ng: { show: "active('/signup')"} }
|
||||
%hr
|
||||
Already have an account?
|
||||
%a{ href: "", ng: { click: "select('/login')"}}
|
||||
Log in now.
|
||||
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
@@ -1,12 +1,12 @@
|
||||
%tab#sign-up-content{"ng-controller" => "SignupCtrl",
|
||||
heading: "Sign up",
|
||||
%tab#sign-up-content{"ng-controller" => "SignupCtrl",
|
||||
heading: "Sign up",
|
||||
active: "active(path)",
|
||||
select: "select(path)"}
|
||||
%form{"ng-submit" => "submit()"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} Your email
|
||||
%input.title.input-text{name: "email",
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: 1,
|
||||
@@ -16,7 +16,7 @@
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "password"} Choose a password
|
||||
%input.title.input-text{name: "password",
|
||||
%input.title.input-text{name: "password",
|
||||
type: "password",
|
||||
id: "password",
|
||||
autocomplete: "off",
|
||||
@@ -27,7 +27,7 @@
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "password_confirmation"} Confirm password
|
||||
%input.title.input-text{name: "password_confirmation",
|
||||
%input.title.input-text{name: "password_confirmation",
|
||||
type: "password",
|
||||
id: "password_confirmation",
|
||||
autocomplete: "off",
|
||||
@@ -35,7 +35,7 @@
|
||||
"ng-model" => "spree_user.password_confirmation"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
value: "Sign up now"}
|
||||
|
||||
@@ -7,7 +7,7 @@ class RegistrationController < BaseController
|
||||
|
||||
def index
|
||||
if spree_current_user.nil?
|
||||
redirect_to registration_auth_path(anchor: "login?after_login=/register")
|
||||
redirect_to registration_auth_path(anchor: "signup?after_login=/register")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user