Class: QuoVadis::ConfirmationsController
- Inherits:
-
QuoVadisController
- Object
- ApplicationController
- QuoVadisController
- QuoVadis::ConfirmationsController
- Defined in:
- app/controllers/quo_vadis/confirmations_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/quo_vadis/confirmations_controller.rb', line 15 def create @account = find_pending_account_from_session unless @account redirect_to qv.path_after_signup, alert: QuoVadis.translate('flash.confirmation.unknown') return end expiry = session[:account_confirmation_expires_at] if Time.current.to_i > expiry redirect_to confirm_path, alert: QuoVadis.translate('flash.confirmation.expired') return end confirmed = @account.confirm(params[:otp], expiry) if !confirmed redirect_to confirm_path, alert: QuoVadis.translate('flash.confirmation.invalid') return end qv.log @account, Log::ACCOUNT_CONFIRMATION session.delete :account_pending_confirmation session.delete :account_confirmation_expires_at redirect_to qv.path_after_signup, notice: QuoVadis.translate('flash.confirmation.confirmed') end |
#new ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/quo_vadis/confirmations_controller.rb', line 6 def new @account = find_pending_account_from_session unless @account redirect_to qv.path_after_signup, alert: QuoVadis.translate('flash.confirmation.unknown') end end |
#resend ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/quo_vadis/confirmations_controller.rb', line 46 def resend @account = find_pending_account_from_session unless @account redirect_to qv.path_after_signup, alert: QuoVadis.translate('flash.confirmation.unknown') end qv.request_confirmation @account.model redirect_to confirm_path, notice: QuoVadis.translate('flash.confirmation.sent') end |