Sha256: a4dc5d606a19f05eb534c67f1ee298be2aa3cdca148d44221b39053066a7016c

Contents?: true

Size: 428 Bytes

Versions: 2

Compression:

Stored size: 428 Bytes

Contents

require 'instant2fa'

Warden::Manager.after_authentication do |user, auth, options|
  begin
    hosted_page_url = Instant2fa.create_verification(user.id.to_s)
    auth.session(options[:scope])[DeviseInstant2fa::NEED_AUTHENTICATION] = true
    auth.session(options[:scope])[DeviseInstant2fa::HOSTED_PAGE_URL] = hosted_page_url
    auth.session(options[:scope])[:id] = user.id
  rescue Instant2fa::Errors::MFANotEnabled
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise_instant2fa-1.0.1 lib/devise_instant2fa/hooks/instant2fa_authenticatable.rb
devise_instant2fa-1.0.0 lib/devise_instant2fa/hooks/instant2fa_authenticatable.rb