Browse Source

Merge pull request #80 from Surzhko/master

replaced flash :error key with :alert
master
Dmitrii Golub 9 years ago
parent
commit
abc06c3a17
  1. 2
      app/controllers/devise/two_factor_authentication_controller.rb
  2. 2
      spec/features/two_factor_authenticatable_spec.rb
  3. 2
      spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb

2
app/controllers/devise/two_factor_authentication_controller.rb

@ -52,7 +52,7 @@ class Devise::TwoFactorAuthenticationController < DeviseController
def after_two_factor_fail_for(resource)
resource.second_factor_attempts_count += 1
resource.save
flash.now[:error] = find_message(:attempt_failed)
set_flash_message :alert, find_message(:attempt_failed), now: true
if resource.max_login_attempts?
sign_out(resource)

2
spec/features/two_factor_authenticatable_spec.rb

@ -84,7 +84,7 @@ feature "User of two factor authentication" do
fill_in "code", with: "incorrect#{rand(100)}"
click_button "Submit"
within(".flash.error") do
within(".flash.alert") do
expect(page).to have_content("Attempt failed")
end
end

2
spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb

@ -114,7 +114,7 @@ describe Devise::Models::TwoFactorAuthenticatable do
expect(uri.scheme).to eq('otpauth')
expect(uri.host).to eq('totp')
expect(uri.path).to eq('/houdini')
expect(uri.path).to eq('/Magic:houdini')
expect(params['issuer'].shift).to eq('Magic')
expect(params['secret'].shift).to match(/\w{16}/)
end

Loading…
Cancel
Save