Browse Source

Controller: authenticate using new one time password algorithm.

master
Matt Mueller 11 years ago
parent
commit
3d8b6c484d
  1. 4
      app/controllers/devise/two_factor_authentication_controller.rb

4
app/controllers/devise/two_factor_authentication_controller.rb

@ -7,8 +7,8 @@ class Devise::TwoFactorAuthenticationController < DeviseController
def update def update
render :show and return if params[:code].nil? render :show and return if params[:code].nil?
md5 = Digest::MD5.hexdigest(params[:code])
if md5.eql?(resource.second_factor_pass_code) if resource.authenticate_otp(params[:code])
warden.session(resource_name)[:need_two_factor_authentication] = false warden.session(resource_name)[:need_two_factor_authentication] = false
sign_in resource_name, resource, :bypass => true sign_in resource_name, resource, :bypass => true
redirect_to stored_location_for(resource_name) || :root redirect_to stored_location_for(resource_name) || :root

Loading…
Cancel
Save