devise-authy 1.7.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.github/workflows/build.yml +32 -0
- data/.gitignore +45 -0
- data/.rspec +1 -0
- data/Appraisals +22 -0
- data/CHANGELOG.md +152 -0
- data/Gemfile +2 -23
- data/LICENSE.txt +1 -1
- data/README.md +147 -36
- data/Rakefile +1 -14
- data/app/controllers/devise/devise_authy_controller.rb +90 -30
- data/app/controllers/devise_authy/passwords_controller.rb +18 -0
- data/app/views/devise/enable_authy.html.erb +2 -2
- data/app/views/devise/enable_authy.html.haml +2 -2
- data/app/views/devise/verify_authy.html.erb +23 -6
- data/app/views/devise/verify_authy.html.haml +21 -6
- data/app/views/devise/verify_authy_installation.html.erb +14 -6
- data/app/views/devise/verify_authy_installation.html.haml +12 -4
- data/config/locales/en.yml +8 -4
- data/config.ru +9 -0
- data/devise-authy.gemspec +44 -239
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_5_2.gemfile +14 -0
- data/gemfiles/rails_6.gemfile +15 -0
- data/lib/devise-authy/controllers/helpers.rb +31 -12
- data/lib/devise-authy/controllers/view_helpers.rb +13 -7
- data/lib/devise-authy/mapping.rb +10 -7
- data/lib/devise-authy/models/authy_authenticatable.rb +2 -2
- data/lib/devise-authy/rails.rb +1 -1
- data/lib/devise-authy/routes.rb +3 -2
- data/lib/devise-authy/version.rb +5 -0
- data/lib/devise-authy.rb +8 -1
- data/lib/generators/active_record/devise_authy_generator.rb +11 -1
- data/lib/generators/active_record/templates/migration.rb +1 -1
- data/lib/generators/devise_authy/devise_authy_generator.rb +8 -8
- data/lib/generators/devise_authy/install_generator.rb +19 -5
- metadata +173 -205
- data/Gemfile.lock +0 -194
- data/VERSION +0 -1
- data/authy-devise-demo/.gitignore +0 -15
- data/authy-devise-demo/Gemfile +0 -40
- data/authy-devise-demo/Gemfile.lock +0 -141
- 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 -10
- data/authy-devise-demo/app/models/user.rb +0 -10
- 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 -22
- 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/application.rb +0 -62
- 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 -39
- data/authy-devise-demo/config/environments/production.rb +0 -67
- data/authy-devise-demo/config/environments/test.rb +0 -37
- 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 -237
- 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.ru +0 -4
- 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/schema.rb +0 -62
- 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 -271
- data/spec/controllers/passwords_controller_spec.rb +0 -48
- data/spec/features/authy_authenticatable_spec.rb +0 -90
- data/spec/features/authy_lockable_spec.rb +0 -70
- data/spec/generators_spec.rb +0 -30
- 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 -9
- data/spec/rails-app/Gemfile.lock +0 -115
- 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 -11
- 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 -21
- 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/application.rb +0 -49
- 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 -39
- data/spec/rails-app/config/environments/production.rb +0 -67
- data/spec/rails-app/config/environments/test.rb +0 -39
- 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 -245
- 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.ru +0 -4
- 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 -31
- data/spec/spec_helper.rb +0 -29
- data/spec/support/helpers.rb +0 -78
data/spec/routing/routes_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "routes for devise_authy" do
|
4
|
-
it "route to devise_authy#GET_verify_authy" do
|
5
|
-
get('/users/verify_authy').should route_to("devise/devise_authy#GET_verify_authy")
|
6
|
-
end
|
7
|
-
|
8
|
-
it "routes to devise_authy#POST_verify_authy" do
|
9
|
-
post('/users/verify_authy').should route_to("devise/devise_authy#POST_verify_authy")
|
10
|
-
end
|
11
|
-
|
12
|
-
it "routes to devise_authy#GET_enable_authy" do
|
13
|
-
get('/users/enable_authy').should route_to("devise/devise_authy#GET_enable_authy")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "routes to devise_authy#POST_enable_authy" do
|
17
|
-
post('/users/enable_authy').should route_to("devise/devise_authy#POST_enable_authy")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "route to devise_authy#GET_verify_authy_installation" do
|
21
|
-
get('/users/verify_authy_installation').should route_to("devise/devise_authy#GET_verify_authy_installation")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "routes to devise_authy#POST_verify_authy_installation" do
|
25
|
-
post('/users/verify_authy_installation').should route_to("devise/devise_authy#POST_verify_authy_installation")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "routes to devise_authy#request_sms" do
|
29
|
-
post('/users/request-sms').should route_to("devise/devise_authy#request_sms")
|
30
|
-
end
|
31
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
4
|
-
|
5
|
-
require "rails-app/config/environment"
|
6
|
-
require 'rspec/rails'
|
7
|
-
require 'devise-authy'
|
8
|
-
require 'orm/active_record'
|
9
|
-
require 'capybara/rails'
|
10
|
-
require 'capybara/rspec'
|
11
|
-
require 'database_cleaner'
|
12
|
-
|
13
|
-
# Requires supporting files with custom matchers and macros, etc,
|
14
|
-
# in ./support/ and its subdirectories.
|
15
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
16
|
-
|
17
|
-
RSpec.configure do |config|
|
18
|
-
config.before :suite do
|
19
|
-
DatabaseCleaner[:active_record].strategy = :truncation
|
20
|
-
end
|
21
|
-
|
22
|
-
config.before :each do
|
23
|
-
DatabaseCleaner.start
|
24
|
-
end
|
25
|
-
|
26
|
-
config.after :each do
|
27
|
-
DatabaseCleaner.clean
|
28
|
-
end
|
29
|
-
end
|
data/spec/support/helpers.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
$email_count ||= 0
|
2
|
-
def generate_unique_email
|
3
|
-
$email_count += 1
|
4
|
-
"test#{$email_count}@example.com"
|
5
|
-
end
|
6
|
-
|
7
|
-
def valid_attributes(attributes={})
|
8
|
-
{ :email => generate_unique_email,
|
9
|
-
:password => '12345678',
|
10
|
-
:password_confirmation => '12345678' }.update(attributes)
|
11
|
-
end
|
12
|
-
|
13
|
-
def new_user(attributes={})
|
14
|
-
User.new(valid_attributes(attributes))
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_user(attributes={})
|
18
|
-
User.create!(valid_attributes(attributes))
|
19
|
-
end
|
20
|
-
|
21
|
-
def create_lockable_user(attributes={})
|
22
|
-
LockableUser.create!(valid_attributes(attributes))
|
23
|
-
end
|
24
|
-
|
25
|
-
def fill_sign_in_form(email, password, form_selector = nil, sign_in_path = nil)
|
26
|
-
form_selector ||= '#new_user'
|
27
|
-
sign_in_path ||= new_user_session_path
|
28
|
-
|
29
|
-
visit sign_in_path
|
30
|
-
within(form_selector) do
|
31
|
-
fill_in 'Email', :with => email
|
32
|
-
fill_in 'Password', :with => password
|
33
|
-
end
|
34
|
-
click_on 'Sign in'
|
35
|
-
end
|
36
|
-
|
37
|
-
def fill_verify_token_form(token)
|
38
|
-
within('#devise_authy') { fill_in 'authy-token', with: token }
|
39
|
-
click_on 'Check Token'
|
40
|
-
end
|
41
|
-
|
42
|
-
def fill_in_verify_authy_installation_form(token)
|
43
|
-
fill_in 'authy-token', with: token
|
44
|
-
click_on 'Enable my account'
|
45
|
-
end
|
46
|
-
|
47
|
-
def sign_cookie(name, val)
|
48
|
-
verifier = ActiveSupport::MessageVerifier.new(RailsApp::Application.config.secret_token)
|
49
|
-
verifier.generate(val)
|
50
|
-
end
|
51
|
-
|
52
|
-
def too_many_failed_attempts
|
53
|
-
Devise.maximum_attempts + 1
|
54
|
-
end
|
55
|
-
|
56
|
-
def valid_authy_token
|
57
|
-
'0000000'
|
58
|
-
end
|
59
|
-
|
60
|
-
def invalid_authy_token
|
61
|
-
'999999'
|
62
|
-
end
|
63
|
-
|
64
|
-
def lock_user_account
|
65
|
-
too_many_failed_attempts.times { fill_verify_token_form invalid_authy_token }
|
66
|
-
end
|
67
|
-
|
68
|
-
def assert_at(path)
|
69
|
-
expect(current_path).to eq(path)
|
70
|
-
end
|
71
|
-
|
72
|
-
def assert_not_at(path)
|
73
|
-
expect(current_path).not_to eq(path)
|
74
|
-
end
|
75
|
-
|
76
|
-
def assert_account_locked_for(user, is_locked = true)
|
77
|
-
expect(user.access_locked?).to eq(is_locked)
|
78
|
-
end
|