devise-authy 1.8.3 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +44 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -12
- data/README.md +5 -3
- data/Rakefile +1 -14
- data/devise-authy.gemspec +34 -237
- data/lib/devise-authy.rb +1 -0
- data/lib/devise-authy/version.rb +5 -0
- data/lib/generators/active_record/devise_authy_generator.rb +11 -1
- data/lib/generators/active_record/templates/migration.rb +1 -1
- metadata +42 -195
- data/VERSION +0 -1
- data/authy-devise-demo/.gitignore +0 -15
- data/authy-devise-demo/Gemfile +0 -51
- data/authy-devise-demo/Gemfile.lock +0 -194
- data/authy-devise-demo/README.md +0 -64
- data/authy-devise-demo/Rakefile +0 -7
- data/authy-devise-demo/app/assets/images/rails.png +0 -0
- data/authy-devise-demo/app/assets/javascripts/application.js +0 -15
- data/authy-devise-demo/app/assets/javascripts/devise_authy.js +0 -12
- data/authy-devise-demo/app/assets/javascripts/welcome.js.coffee +0 -3
- data/authy-devise-demo/app/assets/stylesheets/application.css +0 -13
- data/authy-devise-demo/app/assets/stylesheets/devise_authy.css +0 -26
- data/authy-devise-demo/app/assets/stylesheets/welcome.css.scss +0 -3
- data/authy-devise-demo/app/controllers/application_controller.rb +0 -3
- data/authy-devise-demo/app/controllers/welcome_controller.rb +0 -15
- data/authy-devise-demo/app/helpers/application_helper.rb +0 -2
- data/authy-devise-demo/app/helpers/welcome_helper.rb +0 -2
- data/authy-devise-demo/app/mailers/.gitkeep +0 -0
- data/authy-devise-demo/app/models/.gitkeep +0 -0
- data/authy-devise-demo/app/models/admin.rb +0 -7
- data/authy-devise-demo/app/models/user.rb +0 -7
- data/authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb +0 -38
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
- data/authy-devise-demo/app/views/layouts/application.html.erb +0 -28
- data/authy-devise-demo/app/views/welcome/admin_page.html.erb +0 -12
- data/authy-devise-demo/app/views/welcome/index.html.erb +0 -5
- data/authy-devise-demo/app/views/welcome/user_page.html.erb +0 -5
- data/authy-devise-demo/config.ru +0 -4
- data/authy-devise-demo/config/application.rb +0 -26
- data/authy-devise-demo/config/boot.rb +0 -6
- data/authy-devise-demo/config/database.yml +0 -25
- data/authy-devise-demo/config/environment.rb +0 -5
- data/authy-devise-demo/config/environments/development.rb +0 -43
- data/authy-devise-demo/config/environments/production.rb +0 -79
- data/authy-devise-demo/config/environments/test.rb +0 -42
- data/authy-devise-demo/config/initializers/authy.rb +0 -1
- data/authy-devise-demo/config/initializers/backtrace_silencers.rb +0 -7
- data/authy-devise-demo/config/initializers/devise.rb +0 -240
- data/authy-devise-demo/config/initializers/inflections.rb +0 -15
- data/authy-devise-demo/config/initializers/mime_types.rb +0 -5
- data/authy-devise-demo/config/initializers/secret_token.rb +0 -7
- data/authy-devise-demo/config/initializers/session_store.rb +0 -8
- data/authy-devise-demo/config/initializers/wrap_parameters.rb +0 -14
- data/authy-devise-demo/config/locales/devise.authy.en.yml +0 -24
- data/authy-devise-demo/config/locales/devise.en.yml +0 -58
- data/authy-devise-demo/config/locales/en.yml +0 -5
- data/authy-devise-demo/config/routes.rb +0 -65
- data/authy-devise-demo/config/secrets.yml +0 -22
- data/authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb +0 -46
- data/authy-devise-demo/db/migrate/20141202000744_devise_create_admins.rb +0 -46
- data/authy-devise-demo/db/migrate/20141202004246_devise_authy_add_to_admins.rb +0 -21
- data/authy-devise-demo/db/migrate/20160906221739_add_sessions_table.rb +0 -12
- data/authy-devise-demo/db/schema.rb +0 -72
- data/authy-devise-demo/db/seeds.rb +0 -7
- data/authy-devise-demo/lib/assets/.gitkeep +0 -0
- data/authy-devise-demo/lib/tasks/.gitkeep +0 -0
- data/authy-devise-demo/log/.gitkeep +0 -0
- data/authy-devise-demo/public/404.html +0 -26
- data/authy-devise-demo/public/422.html +0 -26
- data/authy-devise-demo/public/500.html +0 -25
- data/authy-devise-demo/public/favicon.ico +0 -0
- data/authy-devise-demo/public/robots.txt +0 -5
- data/authy-devise-demo/script/rails +0 -6
- data/authy-devise-demo/test/fixtures/.gitkeep +0 -0
- data/authy-devise-demo/test/fixtures/users.yml +0 -11
- data/authy-devise-demo/test/functional/.gitkeep +0 -0
- data/authy-devise-demo/test/functional/welcome_controller_test.rb +0 -9
- data/authy-devise-demo/test/integration/.gitkeep +0 -0
- data/authy-devise-demo/test/performance/browsing_test.rb +0 -12
- data/authy-devise-demo/test/test_helper.rb +0 -13
- data/authy-devise-demo/test/unit/.gitkeep +0 -0
- data/authy-devise-demo/test/unit/helpers/welcome_helper_test.rb +0 -4
- data/authy-devise-demo/test/unit/user_test.rb +0 -7
- data/authy-devise-demo/vendor/assets/javascripts/.gitkeep +0 -0
- data/authy-devise-demo/vendor/assets/stylesheets/.gitkeep +0 -0
- data/authy-devise-demo/vendor/plugins/.gitkeep +0 -0
- data/spec/controllers/devise_authy_controller_spec.rb +0 -360
- data/spec/controllers/passwords_controller_spec.rb +0 -48
- data/spec/features/authy_authenticatable_spec.rb +0 -108
- data/spec/features/authy_lockable_spec.rb +0 -70
- data/spec/generators_spec.rb +0 -32
- data/spec/models/authy_authenticatable_spec.rb +0 -17
- data/spec/models/authy_lockable_spec.rb +0 -81
- data/spec/orm/active_record.rb +0 -4
- data/spec/rails-app/Gemfile +0 -10
- data/spec/rails-app/Gemfile.lock +0 -141
- data/spec/rails-app/Rakefile +0 -7
- data/spec/rails-app/app/assets/images/rails.png +0 -0
- data/spec/rails-app/app/assets/javascripts/application.js +0 -15
- data/spec/rails-app/app/assets/javascripts/devise_authy.js +0 -12
- data/spec/rails-app/app/assets/javascripts/welcome.js +0 -2
- data/spec/rails-app/app/assets/stylesheets/application.css +0 -13
- data/spec/rails-app/app/assets/stylesheets/devise_authy.css +0 -26
- data/spec/rails-app/app/assets/stylesheets/welcome.css.scss +0 -3
- data/spec/rails-app/app/controllers/application_controller.rb +0 -3
- data/spec/rails-app/app/controllers/welcome_controller.rb +0 -13
- data/spec/rails-app/app/helpers/application_helper.rb +0 -2
- data/spec/rails-app/app/helpers/welcome_helper.rb +0 -2
- data/spec/rails-app/app/mailers/.gitkeep +0 -0
- data/spec/rails-app/app/models/.gitkeep +0 -0
- data/spec/rails-app/app/models/lockable_user.rb +0 -7
- data/spec/rails-app/app/models/user.rb +0 -8
- data/spec/rails-app/app/views/devise/devise_authy/enable_authy.html.erb +0 -7
- data/spec/rails-app/app/views/devise/devise_authy/verify_authy.html.erb +0 -37
- data/spec/rails-app/app/views/devise/devise_authy/verify_authy_installation.html.erb +0 -10
- data/spec/rails-app/app/views/layouts/application.html.erb +0 -28
- data/spec/rails-app/app/views/welcome/index.html.erb +0 -5
- data/spec/rails-app/config.ru +0 -4
- data/spec/rails-app/config/application.rb +0 -30
- data/spec/rails-app/config/boot.rb +0 -6
- data/spec/rails-app/config/database.yml +0 -25
- data/spec/rails-app/config/environment.rb +0 -5
- data/spec/rails-app/config/environments/development.rb +0 -43
- data/spec/rails-app/config/environments/production.rb +0 -79
- data/spec/rails-app/config/environments/test.rb +0 -44
- data/spec/rails-app/config/initializers/authy.rb +0 -2
- data/spec/rails-app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails-app/config/initializers/devise.rb +0 -256
- data/spec/rails-app/config/initializers/inflections.rb +0 -15
- data/spec/rails-app/config/initializers/mime_types.rb +0 -5
- data/spec/rails-app/config/initializers/secret_token.rb +0 -7
- data/spec/rails-app/config/initializers/session_store.rb +0 -8
- data/spec/rails-app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails-app/config/locales/devise.authy.en.yml +0 -24
- data/spec/rails-app/config/locales/devise.en.yml +0 -59
- data/spec/rails-app/config/locales/en.yml +0 -5
- data/spec/rails-app/config/routes.rb +0 -8
- data/spec/rails-app/config/secrets.yml +0 -22
- data/spec/rails-app/db/development.sqlite3 +0 -0
- data/spec/rails-app/db/migrate/20130419164907_devise_create_users.rb +0 -46
- data/spec/rails-app/db/migrate/20130419164936_devise_authy_add_to_users.rb +0 -18
- data/spec/rails-app/db/schema.rb +0 -41
- data/spec/rails-app/db/seeds.rb +0 -7
- data/spec/rails-app/lib/assets/.gitkeep +0 -0
- data/spec/rails-app/lib/tasks/.gitkeep +0 -0
- data/spec/rails-app/public/404.html +0 -26
- data/spec/rails-app/public/422.html +0 -26
- data/spec/rails-app/public/500.html +0 -25
- data/spec/rails-app/public/favicon.ico +0 -0
- data/spec/rails-app/public/robots.txt +0 -5
- data/spec/rails-app/script/rails +0 -6
- data/spec/routing/routes_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -46
- data/spec/support/helpers.rb +0 -80
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe DeviseAuthy::PasswordsController, type: :controller do
|
|
4
|
-
include Devise::Test::ControllerHelpers
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
request.env["devise.mapping"] = Devise.mappings[:user]
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
context "when the user has authy enabled" do
|
|
11
|
-
|
|
12
|
-
describe "Reset password" do
|
|
13
|
-
it "Should redirect to verify token view" do
|
|
14
|
-
user = create_user(:authy_id => 1)
|
|
15
|
-
user.authy_enabled = true
|
|
16
|
-
user.save
|
|
17
|
-
|
|
18
|
-
token = user.send_reset_password_instructions
|
|
19
|
-
|
|
20
|
-
put :update, :user => { :reset_password_token => token, :password => "password", :password_confirmation => "password" }
|
|
21
|
-
|
|
22
|
-
user.reload
|
|
23
|
-
expect(user.last_sign_in_at).to be_nil
|
|
24
|
-
expect(response).to redirect_to(root_url)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "when the user don't have 2FA" do
|
|
30
|
-
describe "Reset password" do
|
|
31
|
-
it "Should sign in the user" do
|
|
32
|
-
user = create_user(:authy_id => 1)
|
|
33
|
-
user.save
|
|
34
|
-
|
|
35
|
-
token = user.send_reset_password_instructions
|
|
36
|
-
|
|
37
|
-
last_sign_in_at = user.last_sign_in_at
|
|
38
|
-
|
|
39
|
-
put :update, :user => { :reset_password_token => token, :password => "password", :password_confirmation => "password" }
|
|
40
|
-
expect(response).to redirect_to(root_url)
|
|
41
|
-
|
|
42
|
-
user.reload
|
|
43
|
-
expect(user.last_sign_in_at).not_to be_nil
|
|
44
|
-
expect(flash[:notice]).to eq("Your password was changed successfully. You are now signed in.")
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Authy Authenticatable", :type => :request do
|
|
4
|
-
describe "If user don't have two factor authentication should login with email - password" do
|
|
5
|
-
before :each do
|
|
6
|
-
@user = create_user(:email => 'foo@bar.com')
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it "Sign in should succeed" do
|
|
10
|
-
fill_sign_in_form('foo@bar.com', '12345678')
|
|
11
|
-
expect(current_path).to eq(root_path)
|
|
12
|
-
expect(page).to have_content('Signed in successfully.')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "Sign in shouldn't succeed" do
|
|
16
|
-
fill_sign_in_form('foo@bar.com', '14567823')
|
|
17
|
-
expect(current_path).to eq(new_user_session_path)
|
|
18
|
-
expect(page).not_to have_content('Signed in successfully.')
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe "If user has two factor authentication" do
|
|
23
|
-
before :each do
|
|
24
|
-
@user = create_user(:authy_id => 75)
|
|
25
|
-
@user.update_attribute(:authy_enabled, true)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "Sign in should succeed" do
|
|
29
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
30
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
31
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
32
|
-
|
|
33
|
-
within('#devise_authy') do
|
|
34
|
-
fill_in 'authy-token', :with => '0000000'
|
|
35
|
-
end
|
|
36
|
-
click_on 'Check Token'
|
|
37
|
-
expect(current_path).to eq(root_path)
|
|
38
|
-
expect(page).to have_content(I18n.t('devise.devise_authy.user.signed_in'))
|
|
39
|
-
@user.reload
|
|
40
|
-
expect(@user.last_sign_in_with_authy).not_to be_nil
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "Sign in shouldn't succeed" do
|
|
44
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
45
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
46
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
47
|
-
|
|
48
|
-
within('#devise_authy') do
|
|
49
|
-
fill_in 'authy-token', :with => '324567'
|
|
50
|
-
end
|
|
51
|
-
click_on 'Check Token'
|
|
52
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
53
|
-
@user.reload
|
|
54
|
-
expect(@user.last_sign_in_with_authy).to be_nil
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
describe "With cookie['remember_device']" do
|
|
58
|
-
it "prompts for a token when cookie expired" do
|
|
59
|
-
expires = { expires: 2.months.ago.to_i, id: @user.id }.to_json
|
|
60
|
-
cookie_val = sign_cookie("remember_device", expires)
|
|
61
|
-
page.driver.browser.set_cookie("remember_device=#{cookie_val}")
|
|
62
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
63
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
64
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "no prompt for a token" do
|
|
68
|
-
expires = { expires: Time.now.to_i, id: @user.id }.to_json
|
|
69
|
-
cookie_val = sign_cookie("remember_device", expires)
|
|
70
|
-
page.driver.browser.set_cookie("remember_device=#{cookie_val}")
|
|
71
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
72
|
-
expect(current_path).to eq(root_path)
|
|
73
|
-
expect(page).to have_content("Signed in successfully.")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "prompts for a token when user has an old cookie" do
|
|
77
|
-
cookie_val = sign_cookie("remember_device", 2.months.ago.to_i)
|
|
78
|
-
page.driver.browser.set_cookie("remember_device=#{cookie_val}")
|
|
79
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
80
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
81
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "prompts for a token when cookie has an invalid json" do
|
|
85
|
-
cookie_val = sign_cookie("remember_device", "{")
|
|
86
|
-
page.driver.browser.set_cookie("remember_device=#{cookie_val}")
|
|
87
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
88
|
-
expect(current_path).to eq(user_verify_authy_path)
|
|
89
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "With cookie['current_user_id'] and cookie['user_password_checked']" do
|
|
94
|
-
page.driver.browser.set_cookie("current_user_id=#{@user.id}")
|
|
95
|
-
page.driver.browser.set_cookie('user_password_checked=true')
|
|
96
|
-
|
|
97
|
-
visit user_verify_authy_path
|
|
98
|
-
expect(current_path).to eq(new_user_session_path)
|
|
99
|
-
expect(page).to have_content('Log in')
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
it "Click link Request sms" do
|
|
103
|
-
fill_sign_in_form(@user.email, '12345678')
|
|
104
|
-
click_link 'Request SMS'
|
|
105
|
-
expect(page).to have_content("Token was sent.")
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
feature 'Authy Lockable' do
|
|
4
|
-
|
|
5
|
-
context 'during verify code when Authy enabled' do
|
|
6
|
-
|
|
7
|
-
let(:user) do
|
|
8
|
-
u = create_lockable_user authy_id: 20, email: 'foo@bar.com'
|
|
9
|
-
u.update_attribute :authy_enabled, true
|
|
10
|
-
u
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
before :each do
|
|
14
|
-
fill_sign_in_form user.email, '12345678', '#new_lockable_user', new_lockable_user_session_path
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
scenario 'account locked when user enters invalid code too many times' do
|
|
18
|
-
(LockableUser.maximum_attempts - 1).times do |i|
|
|
19
|
-
fill_verify_token_form invalid_authy_token
|
|
20
|
-
assert_at lockable_user_verify_authy_path
|
|
21
|
-
expect(page).to have_content('Please enter your Authy token')
|
|
22
|
-
user.reload
|
|
23
|
-
assert_account_locked_for user, false
|
|
24
|
-
expect(user.failed_attempts).to eq(i + 1)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
fill_verify_token_form invalid_authy_token
|
|
28
|
-
user.reload
|
|
29
|
-
assert_at new_user_session_path
|
|
30
|
-
assert_account_locked_for user, true
|
|
31
|
-
visit root_path
|
|
32
|
-
assert_at new_user_session_path
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context 'during verify Authy installation' do
|
|
38
|
-
|
|
39
|
-
let(:user) { create_lockable_user email: 'foo@bar.com' }
|
|
40
|
-
|
|
41
|
-
before do
|
|
42
|
-
fill_sign_in_form user.email, '12345678', '#new_lockable_user', new_lockable_user_session_path
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
scenario 'account locked when user enters invalid code too many times' do
|
|
46
|
-
visit lockable_user_enable_authy_path
|
|
47
|
-
fill_in 'authy-countries', with: '1'
|
|
48
|
-
fill_in 'authy-cellphone', with: '8001234567'
|
|
49
|
-
click_on 'Enable'
|
|
50
|
-
|
|
51
|
-
(LockableUser.maximum_attempts - 1).times do |i|
|
|
52
|
-
fill_in_verify_authy_installation_form invalid_authy_token
|
|
53
|
-
assert_at lockable_user_verify_authy_installation_path
|
|
54
|
-
expect(page).to have_content('Verify your account')
|
|
55
|
-
user.reload
|
|
56
|
-
assert_account_locked_for user, false
|
|
57
|
-
expect(user.failed_attempts).to eq(i + 1)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
fill_in_verify_authy_installation_form invalid_authy_token
|
|
61
|
-
user.reload
|
|
62
|
-
assert_at new_user_session_path
|
|
63
|
-
assert_account_locked_for user, true
|
|
64
|
-
visit root_path
|
|
65
|
-
assert_at new_user_session_path
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
end
|
data/spec/generators_spec.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
|
|
4
|
-
require 'rails/generators'
|
|
5
|
-
require 'generators/devise_authy/devise_authy_generator'
|
|
6
|
-
|
|
7
|
-
describe "generators for devise_authy" do
|
|
8
|
-
RAILS_APP_PATH = File.expand_path("../rails-app", __FILE__)
|
|
9
|
-
|
|
10
|
-
def rails_command(*args)
|
|
11
|
-
`cd #{RAILS_APP_PATH} && BUNDLE_GEMFILE=#{RAILS_APP_PATH}/Gemfile bundle exec rails #{args.join(" ")}`
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "rails g should include the generators" do
|
|
15
|
-
@output = rails_command("g")
|
|
16
|
-
expect(@output.include?('devise_authy:install')).to be_truthy
|
|
17
|
-
expect(@output.include?('active_record:devise_authy')).to be_truthy
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "rails g devise_authy:install" do
|
|
21
|
-
@output = rails_command("g", "devise_authy:install", "-s")
|
|
22
|
-
|
|
23
|
-
expect(@output.include?('config/initializers/devise.rb')).to be_truthy
|
|
24
|
-
expect(@output.include?('authy.rb')).to be_truthy
|
|
25
|
-
expect(@output.include?('config/locales/devise.authy.en.yml')).to be_truthy
|
|
26
|
-
expect(@output.include?('app/views/devise/devise_authy/enable_authy.html.erb')).to be_truthy
|
|
27
|
-
expect(@output.include?('app/views/devise/devise_authy/verify_authy.html.erb')).to be_truthy
|
|
28
|
-
expect(@output.include?('app/views/devise/devise_authy/verify_authy_installation.html.erb')).to be_truthy
|
|
29
|
-
expect(@output.include?('app/assets/stylesheets/devise_authy.css')).to be_truthy
|
|
30
|
-
expect(@output.include?('app/assets/javascripts/devise_authy.js')).to be_truthy
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Devise::Models::AuthyAuthenticatable, type: :model do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@user = create_user(:authy_id => '20')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
describe "User#find_by_authy_id" do
|
|
9
|
-
it "Should find the user" do
|
|
10
|
-
expect(User.find_by_authy_id('20')).not_to be_nil
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "Shouldn't find the user" do
|
|
14
|
-
expect(User.find_by_authy_id('80')).to be_nil
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Devise::Models::AuthyLockable, type: :controller do
|
|
4
|
-
|
|
5
|
-
context 'model includes Devise::Models::Lockable' do
|
|
6
|
-
|
|
7
|
-
let(:user) { create_lockable_user authy_id: '20' }
|
|
8
|
-
|
|
9
|
-
context '#lockable?' do
|
|
10
|
-
|
|
11
|
-
it 'returns true if lock_strategy is :failed_attempts' do
|
|
12
|
-
expect(user.lockable?).to be_truthy
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'returns false if lock_strategy is anything other than :failed attempts' do
|
|
16
|
-
Devise.lock_strategy = :none
|
|
17
|
-
expect(user.lockable?).to be_falsey
|
|
18
|
-
Devise.lock_strategy = :failed_attempts
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context '#invalid_authy_attempt!' do
|
|
24
|
-
|
|
25
|
-
it 'resets failed_attempts to 0 if nil' do
|
|
26
|
-
user.update_attribute :failed_attempts, nil
|
|
27
|
-
user.invalid_authy_attempt!
|
|
28
|
-
expect(user.failed_attempts).to eq(1)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'updates failed_attempts' do
|
|
32
|
-
10.times { user.invalid_authy_attempt! }
|
|
33
|
-
expect(user.failed_attempts).to eq(10)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it 'respects the maximum attempts configuration for Devise::Models::Lockable' do
|
|
37
|
-
4.times { user.invalid_authy_attempt! }
|
|
38
|
-
expect(user.send :attempts_exceeded?).to be_truthy # protected method
|
|
39
|
-
expect(user.access_locked?).to be_truthy
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'returns true if the account is locked' do
|
|
43
|
-
3.times { user.invalid_authy_attempt! }
|
|
44
|
-
expect(user.invalid_authy_attempt!).to be_truthy
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'returns false if the account is not locked' do
|
|
48
|
-
expect(user.invalid_authy_attempt!).to be_falsey
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
context 'model misconfigured, includes AuthyLockable w/out Lockable' do
|
|
56
|
-
|
|
57
|
-
let(:user) do
|
|
58
|
-
u = create_user authy_id: '20'
|
|
59
|
-
u.extend Devise::Models::AuthyLockable
|
|
60
|
-
u
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
context '#lockable?' do
|
|
64
|
-
|
|
65
|
-
it 'raises an error' do
|
|
66
|
-
expect { user.lockable? }.to raise_error 'Devise lockable extension required'
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
context '#invalid_authy_attempt!' do
|
|
72
|
-
|
|
73
|
-
it 'raises an error' do
|
|
74
|
-
expect { user.invalid_authy_attempt! }.to raise_error 'Devise lockable extension required'
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
end
|
data/spec/orm/active_record.rb
DELETED
data/spec/rails-app/Gemfile
DELETED
data/spec/rails-app/Gemfile.lock
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ../..
|
|
3
|
-
specs:
|
|
4
|
-
devise-authy (1.8.2)
|
|
5
|
-
authy (>= 2.7.2)
|
|
6
|
-
devise (>= 3.0.0)
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: https://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
actionmailer (4.2.10)
|
|
12
|
-
actionpack (= 4.2.10)
|
|
13
|
-
actionview (= 4.2.10)
|
|
14
|
-
activejob (= 4.2.10)
|
|
15
|
-
mail (~> 2.5, >= 2.5.4)
|
|
16
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
17
|
-
actionpack (4.2.10)
|
|
18
|
-
actionview (= 4.2.10)
|
|
19
|
-
activesupport (= 4.2.10)
|
|
20
|
-
rack (~> 1.6)
|
|
21
|
-
rack-test (~> 0.6.2)
|
|
22
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
23
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
24
|
-
actionview (4.2.10)
|
|
25
|
-
activesupport (= 4.2.10)
|
|
26
|
-
builder (~> 3.1)
|
|
27
|
-
erubis (~> 2.7.0)
|
|
28
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
29
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
30
|
-
activejob (4.2.10)
|
|
31
|
-
activesupport (= 4.2.10)
|
|
32
|
-
globalid (>= 0.3.0)
|
|
33
|
-
activemodel (4.2.10)
|
|
34
|
-
activesupport (= 4.2.10)
|
|
35
|
-
builder (~> 3.1)
|
|
36
|
-
activerecord (4.2.10)
|
|
37
|
-
activemodel (= 4.2.10)
|
|
38
|
-
activesupport (= 4.2.10)
|
|
39
|
-
arel (~> 6.0)
|
|
40
|
-
activesupport (4.2.10)
|
|
41
|
-
i18n (~> 0.7)
|
|
42
|
-
minitest (~> 5.1)
|
|
43
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
|
44
|
-
tzinfo (~> 1.1)
|
|
45
|
-
addressable (2.5.2)
|
|
46
|
-
public_suffix (>= 2.0.2, < 4.0)
|
|
47
|
-
arel (6.0.4)
|
|
48
|
-
authy (2.7.2)
|
|
49
|
-
httpclient (>= 2.5.3.3)
|
|
50
|
-
bcrypt (3.1.11)
|
|
51
|
-
builder (3.2.3)
|
|
52
|
-
concurrent-ruby (1.0.5)
|
|
53
|
-
crass (1.0.3)
|
|
54
|
-
devise (4.3.0)
|
|
55
|
-
bcrypt (~> 3.0)
|
|
56
|
-
orm_adapter (~> 0.1)
|
|
57
|
-
railties (>= 4.1.0, < 5.2)
|
|
58
|
-
responders
|
|
59
|
-
warden (~> 1.2.3)
|
|
60
|
-
erubis (2.7.0)
|
|
61
|
-
globalid (0.4.1)
|
|
62
|
-
activesupport (>= 4.2.0)
|
|
63
|
-
httpclient (2.8.3)
|
|
64
|
-
i18n (0.9.1)
|
|
65
|
-
concurrent-ruby (~> 1.0)
|
|
66
|
-
json (2.1.0)
|
|
67
|
-
launchy (2.4.3)
|
|
68
|
-
addressable (~> 2.3)
|
|
69
|
-
loofah (2.1.1)
|
|
70
|
-
crass (~> 1.0.2)
|
|
71
|
-
nokogiri (>= 1.5.9)
|
|
72
|
-
mail (2.7.0)
|
|
73
|
-
mini_mime (>= 0.1.1)
|
|
74
|
-
mini_mime (1.0.0)
|
|
75
|
-
mini_portile2 (2.3.0)
|
|
76
|
-
minitest (5.10.3)
|
|
77
|
-
nokogiri (1.8.1)
|
|
78
|
-
mini_portile2 (~> 2.3.0)
|
|
79
|
-
orm_adapter (0.5.0)
|
|
80
|
-
public_suffix (3.0.1)
|
|
81
|
-
rack (1.6.8)
|
|
82
|
-
rack-test (0.6.3)
|
|
83
|
-
rack (>= 1.0)
|
|
84
|
-
rails (4.2.10)
|
|
85
|
-
actionmailer (= 4.2.10)
|
|
86
|
-
actionpack (= 4.2.10)
|
|
87
|
-
actionview (= 4.2.10)
|
|
88
|
-
activejob (= 4.2.10)
|
|
89
|
-
activemodel (= 4.2.10)
|
|
90
|
-
activerecord (= 4.2.10)
|
|
91
|
-
activesupport (= 4.2.10)
|
|
92
|
-
bundler (>= 1.3.0, < 2.0)
|
|
93
|
-
railties (= 4.2.10)
|
|
94
|
-
sprockets-rails
|
|
95
|
-
rails-deprecated_sanitizer (1.0.3)
|
|
96
|
-
activesupport (>= 4.2.0.alpha)
|
|
97
|
-
rails-dom-testing (1.0.8)
|
|
98
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
|
99
|
-
nokogiri (~> 1.6)
|
|
100
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
|
101
|
-
rails-html-sanitizer (1.0.3)
|
|
102
|
-
loofah (~> 2.0)
|
|
103
|
-
railties (4.2.10)
|
|
104
|
-
actionpack (= 4.2.10)
|
|
105
|
-
activesupport (= 4.2.10)
|
|
106
|
-
rake (>= 0.8.7)
|
|
107
|
-
thor (>= 0.18.1, < 2.0)
|
|
108
|
-
rake (12.3.0)
|
|
109
|
-
responders (2.4.0)
|
|
110
|
-
actionpack (>= 4.2.0, < 5.3)
|
|
111
|
-
railties (>= 4.2.0, < 5.3)
|
|
112
|
-
sprockets (3.7.1)
|
|
113
|
-
concurrent-ruby (~> 1.0)
|
|
114
|
-
rack (> 1, < 3)
|
|
115
|
-
sprockets-rails (3.2.1)
|
|
116
|
-
actionpack (>= 4.0)
|
|
117
|
-
activesupport (>= 4.0)
|
|
118
|
-
sprockets (>= 3.0.0)
|
|
119
|
-
sqlite3 (1.3.13)
|
|
120
|
-
thor (0.20.0)
|
|
121
|
-
thread_safe (0.3.6)
|
|
122
|
-
tzinfo (1.2.4)
|
|
123
|
-
thread_safe (~> 0.1)
|
|
124
|
-
warden (1.2.7)
|
|
125
|
-
rack (>= 1.0)
|
|
126
|
-
|
|
127
|
-
PLATFORMS
|
|
128
|
-
ruby
|
|
129
|
-
|
|
130
|
-
DEPENDENCIES
|
|
131
|
-
authy
|
|
132
|
-
devise (>= 3.0.0)
|
|
133
|
-
devise-authy!
|
|
134
|
-
json (>= 1.8.1)
|
|
135
|
-
launchy
|
|
136
|
-
rails (~> 4.2.7)
|
|
137
|
-
rake
|
|
138
|
-
sqlite3
|
|
139
|
-
|
|
140
|
-
BUNDLED WITH
|
|
141
|
-
1.16.0
|