3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/devise/touchpass_controller.rb', line 3
def show
self.resource = send("current_#{resource_name}")
attempts = warden.session[:touchpass_attempts] || 0
warden.session[:touchpass_attempts] = attempts + 1
if warden.session[:touchpass_attempts] > Devise.touchpass_refresh_attempts
warden.session.delete(:need_touchpass_authentication)
sign_out(resource)
set_flash_message :alert, :touchpass_verification_attempts_exceeded
redirect_to after_sign_out_path_for(resource_name)
return
end
if touchpass_verified?
warden.session[:need_touchpass_authentication] = false
set_flash_message :alert, :touchpass_verification_successful
redirect_to(stored_location_for(resource_name) || :root)
elsif touchpass_rejected?
warden.session.delete(:need_touchpass_authentication)
sign_out(resource)
set_flash_message :alert, :touchpass_verification_rejected
redirect_to after_sign_out_path_for(resource_name)
else
render :show
end
end
|