mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Disable password reset for unconfirmed users
This commit is contained in:
committed by
Rob Harrington
parent
1782a8c700
commit
1f23402912
@@ -6,7 +6,14 @@ Darkswarm.controller "ForgotCtrl", ($scope, $http, $location, AuthenticationServ
|
||||
if $scope.spree_user.email != null
|
||||
$http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).success (data)->
|
||||
$scope.sent = true
|
||||
.error (data) ->
|
||||
$scope.errors = t 'email_not_found'
|
||||
.error (data, status) ->
|
||||
$scope.errors = data.error
|
||||
$scope.user_unconfirmed = (status == 401)
|
||||
else
|
||||
$scope.errors = t 'email_required'
|
||||
|
||||
$scope.resend_confirmation = ->
|
||||
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user}).success (data)->
|
||||
$scope.messages = t('devise.confirmations.send_instructions')
|
||||
.error (data) ->
|
||||
$scope.errors = t('devise.confirmations.failed_to_send')
|
||||
|
||||
@@ -2,24 +2,28 @@
|
||||
%form{ ng: { controller: "ForgotCtrl", submit: "submit()" } }
|
||||
.row
|
||||
.large-12.columns
|
||||
.alert-box.success.radius{"ng-show" => "sent"}
|
||||
{{'password_reset_sent' | t}}
|
||||
.alert-box.success{"ng-show" => "sent"}
|
||||
{{ 'password_reset_sent' | t }}
|
||||
|
||||
%div{"ng-show" => "!sent"}
|
||||
.alert-box.alert{"ng-show" => "errors != null"}
|
||||
{{ errors }}
|
||||
.alert-box.success{"ng-show" => "messages != null"}
|
||||
{{ messages }}
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} {{'signup_email' | t}}
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: 1,
|
||||
"ng-model" => "spree_user.email"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
value: "{{'reset_password' | t}}"}
|
||||
.alert-box.alert{"ng-show" => "errors != null"}
|
||||
{{ errors }}
|
||||
%a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}}
|
||||
= t('devise.confirmations.resend_confirmation_email')
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} {{'signup_email' | t}}
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: 1,
|
||||
"ng-model" => "spree_user.email"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
value: "{{'reset_password' | t}}"}
|
||||
|
||||
Reference in New Issue
Block a user