Sha256: 2423964f18cac113b36cea14108a8e29922dd8de8de10663a6034ff73a531d7d
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
class Devise::TwoFactorAuthenticationController < DeviseController prepend_before_filter :authenticate_scope! before_filter :prepare_and_validate, :handle_two_factor_authentication def show end def update render :show and return if params[:code].nil? if resource.authenticate_otp(params[:code]) warden.session(resource_name)[:need_two_factor_authentication] = false sign_in resource_name, resource, :bypass => true redirect_to stored_location_for(resource_name) || :root resource.update_attribute(:second_factor_attempts_count, 0) else resource.second_factor_attempts_count += 1 resource.save set_flash_message :error, :attempt_failed if resource.max_login_attempts? sign_out(resource) render :template => 'devise/two_factor_authentication/max_login_attempts_reached' and return else render :show end end end private def authenticate_scope! self.resource = send("current_#{resource_name}") end def prepare_and_validate redirect_to :root and return if resource.nil? @limit = resource.class.max_login_attempts if resource.max_login_attempts? sign_out(resource) render :template => 'devise/two_factor_authentication/max_login_attempts_reached' and return end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
two_factor_authentication-1.0 | app/controllers/devise/two_factor_authentication_controller.rb |