Update :return_url value when re-sending email confirmations

This commit is contained in:
Matt-Yorkley
2018-04-18 16:26:39 +01:00
committed by Rob Harrington
parent 1f23402912
commit 1c57f0f241
3 changed files with 7 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ Darkswarm.controller "ForgotCtrl", ($scope, $http, $location, AuthenticationServ
$scope.errors = t 'email_required'
$scope.resend_confirmation = ->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user}).success (data)->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).success (data)->
$scope.messages = t('devise.confirmations.send_instructions')
.error (data) ->
$scope.errors = t('devise.confirmations.failed_to_send')

View File

@@ -14,7 +14,7 @@ Darkswarm.controller "LoginCtrl", ($scope, $timeout, $location, $http, $window,
$scope.user_unconfirmed = (data.error == t('devise.failure.unconfirmed'))
$scope.resend_confirmation = ->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user}).success (data)->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).success (data)->
$scope.messages = t('devise.confirmations.send_instructions')
.error (data) ->
$scope.errors = t('devise.confirmations.failed_to_send')

View File

@@ -8,6 +8,7 @@ class UserConfirmationsController < DeviseController
# POST /resource/confirmation
def create
set_return_url if params.key? :return_url
self.resource = resource_class.send_confirmation_instructions(resource_params)
if is_navigational_format?
@@ -30,6 +31,10 @@ class UserConfirmationsController < DeviseController
protected
def set_return_url
session[:confirmation_return_url] = params[:return_url]
end
def after_confirmation_path_for(resource)
result =
if resource.errors.empty?