Class: QuoVadis::ConfirmationsController

Inherits:
QuoVadisController show all
Defined in:
app/controllers/quo_vadis/confirmations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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 = 

  unless @account
    redirect_to qv., 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., notice: QuoVadis.translate('flash.confirmation.confirmed')
end

#newObject



6
7
8
9
10
11
12
# File 'app/controllers/quo_vadis/confirmations_controller.rb', line 6

def new
  @account = 

  unless @account
    redirect_to qv., alert: QuoVadis.translate('flash.confirmation.unknown')
  end
end

#resendObject



46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/quo_vadis/confirmations_controller.rb', line 46

def resend
  @account = 

  unless @account
    redirect_to qv., alert: QuoVadis.translate('flash.confirmation.unknown')
  end

  qv.request_confirmation @account.model
  redirect_to confirm_path, notice: QuoVadis.translate('flash.confirmation.sent')
end