Show confirmation message in modal

This commit is contained in:
Matt-Yorkley
2018-02-15 17:47:54 +00:00
committed by Maikel Linke
parent bc621a3c43
commit 595bc5d1a5
3 changed files with 21 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "LoginCtrl", ($scope, $http, $window, AuthenticationService, Redirections, Loading) ->
Darkswarm.controller "LoginCtrl", ($scope, $timeout, $location, $http, $window, AuthenticationService, Redirections, Loading) ->
$scope.path = "/login"
$scope.submit = ->
@@ -17,4 +17,11 @@ Darkswarm.controller "LoginCtrl", ($scope, $http, $window, AuthenticationService
$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')
$scope.errors = t('devise.confirmations.failed_to_send')
$timeout ->
if angular.isDefined($location.search()['confirmation'])
if $location.search()['confirmation'] == 'confirmed'
$scope.messages = t('devise.confirmations.confirmed')
if $location.search()['confirmation'] == 'not_confirmed'
$scope.errors = t('devise.confirmations.not_confirmed')

View File

@@ -25,20 +25,20 @@ class UserConfirmationsController < DeviseController
def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
if is_navigational_format?
if resource.errors.empty?
set_flash_message(:success, :confirmed)
else
set_flash_message(:error, :not_confirmed)
end
end
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource) }
end
protected
def after_confirmation_path_for(resource)
session[:confirmation_return_url] || login_path
def after_confirmation_path_for(_resource)
result =
if resource.errors.empty?
'confirmed'
else
'not_confirmed'
end
url = session[:confirmation_return_url] || login_path
url + "?confirmation=#{result}"
end
end

View File

@@ -99,6 +99,8 @@ en:
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
failed_to_send: "An error occurred whilst sending your confirmation email."
resend_confirmation_email: "Resend confirmation email."
confirmed: "Thanks for confirming your email! You can now sign in."
not_confirmed: "Your email address could not be confirmed. Perhaps you have already completed this step?"
user_registrations:
spree_user:
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
@@ -107,12 +109,6 @@ en:
Invalid email or password.
Were you a guest last time? Perhaps you need to create an account or reset your password.
unconfirmed: "You have to confirm your account before continuing."
enterprise_confirmations:
enterprise:
confirmed: Thank you, your email address has been confirmed.
not_confirmed: Your email address could not be confirmed. Perhaps you have already completed this step?
confirmation_sent: "Confirmation email sent!"
confirmation_not_sent: "Could not send a confirmation email."
enterprise_mailer:
confirmation_instructions:
subject: "Please confirm the email address for %{enterprise}"