Class: RailsSimpleAuth::ConfirmationsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- RailsSimpleAuth::ConfirmationsController
- Defined in:
- app/controllers/rails_simple_auth/confirmations_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/rails_simple_auth/confirmations_controller.rb', line 34 def create user = user_class.find_by(email: params[:email]) if user.respond_to?(:unconfirmed_or_reconfirming?) && user.unconfirmed_or_reconfirming? token = user.generate_confirmation_token RailsSimpleAuth.configuration.mailer.confirmation(user, token).deliver_later end redirect_to new_session_path, notice: 'If an unconfirmed account exists with that email, confirmation instructions have been sent.' end |
#new ⇒ Object
32 |
# File 'app/controllers/rails_simple_auth/confirmations_controller.rb', line 32 def new; end |
#show ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/rails_simple_auth/confirmations_controller.rb', line 14 def show user = user_class.find_signed(params[:token], purpose: :confirm_email) if user confirmed = user.respond_to?(:confirm!) ? user.confirm! : true if confirmed run_after_confirmation_callback(user) redirect_to resolve_path(:after_confirmation_path), notice: 'Email confirmed! You can now sign in.' else = user.errors..first || 'Could not confirm email.' redirect_to new_confirmation_path, alert: end else redirect_to new_confirmation_path, alert: 'Invalid or expired confirmation link.' end end |