devise-authy 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +138 -0
- data/LICENSE.txt +20 -0
- data/README.md +86 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/devise_authy.js +7 -0
- data/app/assets/stylesheets/devise_authy.css +26 -0
- data/app/assets/stylesheets/devise_authy.sass +23 -0
- data/app/controllers/devise/devise_authy_controller.rb +109 -0
- data/app/views/devise/enable_authy.html.erb +8 -0
- data/app/views/devise/enable_authy.html.haml +8 -0
- data/app/views/devise/verify_authy.html.erb +13 -0
- data/app/views/devise/verify_authy.html.haml +11 -0
- data/app/views/devise/verify_authy_installation.html.erb +10 -0
- data/app/views/devise/verify_authy_installation.html.haml +8 -0
- data/authy-devise-demo/.gitignore +15 -0
- data/authy-devise-demo/Gemfile +39 -0
- data/authy-devise-demo/Gemfile.lock +134 -0
- data/authy-devise-demo/README.md +64 -0
- data/authy-devise-demo/Rakefile +7 -0
- data/authy-devise-demo/app/assets/images/rails.png +0 -0
- data/authy-devise-demo/app/assets/javascripts/application.js +15 -0
- data/authy-devise-demo/app/assets/javascripts/devise_authy.js +7 -0
- data/authy-devise-demo/app/assets/javascripts/welcome.js.coffee +3 -0
- data/authy-devise-demo/app/assets/stylesheets/application.css +13 -0
- data/authy-devise-demo/app/assets/stylesheets/devise_authy.css +26 -0
- data/authy-devise-demo/app/assets/stylesheets/welcome.css.scss +3 -0
- data/authy-devise-demo/app/controllers/application_controller.rb +3 -0
- data/authy-devise-demo/app/controllers/welcome_controller.rb +6 -0
- data/authy-devise-demo/app/helpers/application_helper.rb +2 -0
- data/authy-devise-demo/app/helpers/welcome_helper.rb +2 -0
- data/authy-devise-demo/app/mailers/.gitkeep +0 -0
- data/authy-devise-demo/app/models/.gitkeep +0 -0
- data/authy-devise-demo/app/models/user.rb +11 -0
- data/authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb +8 -0
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb +13 -0
- data/authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb +10 -0
- data/authy-devise-demo/app/views/layouts/application.html.erb +18 -0
- data/authy-devise-demo/app/views/welcome/index.html.erb +5 -0
- data/authy-devise-demo/config.ru +4 -0
- data/authy-devise-demo/config/application.rb +62 -0
- data/authy-devise-demo/config/boot.rb +6 -0
- data/authy-devise-demo/config/database.yml +25 -0
- data/authy-devise-demo/config/environment.rb +5 -0
- data/authy-devise-demo/config/environments/development.rb +37 -0
- data/authy-devise-demo/config/environments/production.rb +67 -0
- data/authy-devise-demo/config/environments/test.rb +37 -0
- data/authy-devise-demo/config/initializers/authy.rb +1 -0
- data/authy-devise-demo/config/initializers/backtrace_silencers.rb +7 -0
- data/authy-devise-demo/config/initializers/devise.rb +232 -0
- data/authy-devise-demo/config/initializers/inflections.rb +15 -0
- data/authy-devise-demo/config/initializers/mime_types.rb +5 -0
- data/authy-devise-demo/config/initializers/secret_token.rb +7 -0
- data/authy-devise-demo/config/initializers/session_store.rb +8 -0
- data/authy-devise-demo/config/initializers/wrap_parameters.rb +14 -0
- data/authy-devise-demo/config/locales/devise.authy.en.yml +18 -0
- data/authy-devise-demo/config/locales/devise.en.yml +58 -0
- data/authy-devise-demo/config/locales/en.yml +5 -0
- data/authy-devise-demo/config/routes.rb +62 -0
- data/authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb +46 -0
- data/authy-devise-demo/db/migrate/20130409234434_devise_authy_add_to_users.rb +18 -0
- data/authy-devise-demo/db/schema.rb +38 -0
- data/authy-devise-demo/db/seeds.rb +7 -0
- 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 +26 -0
- data/authy-devise-demo/public/422.html +26 -0
- data/authy-devise-demo/public/500.html +25 -0
- data/authy-devise-demo/public/favicon.ico +0 -0
- data/authy-devise-demo/public/robots.txt +5 -0
- data/authy-devise-demo/script/rails +6 -0
- data/authy-devise-demo/test/fixtures/.gitkeep +0 -0
- data/authy-devise-demo/test/fixtures/users.yml +11 -0
- data/authy-devise-demo/test/functional/.gitkeep +0 -0
- data/authy-devise-demo/test/functional/welcome_controller_test.rb +9 -0
- data/authy-devise-demo/test/integration/.gitkeep +0 -0
- data/authy-devise-demo/test/performance/browsing_test.rb +12 -0
- data/authy-devise-demo/test/test_helper.rb +13 -0
- data/authy-devise-demo/test/unit/.gitkeep +0 -0
- data/authy-devise-demo/test/unit/helpers/welcome_helper_test.rb +4 -0
- data/authy-devise-demo/test/unit/user_test.rb +7 -0
- 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/config/locales/en.yml +18 -0
- data/devise-authy.gemspec +223 -0
- data/lib/devise-authy.rb +22 -0
- data/lib/devise-authy/controllers/helpers.rb +39 -0
- data/lib/devise-authy/controllers/view_helpers.rb +36 -0
- data/lib/devise-authy/hooks/authy_authenticatable.rb +7 -0
- data/lib/devise-authy/models/authy_authenticatable.rb +23 -0
- data/lib/devise-authy/rails.rb +11 -0
- data/lib/devise-authy/routes.rb +20 -0
- data/lib/devise-authy/version.rb +3 -0
- data/lib/generators/active_record/devise_authy_generator.rb +13 -0
- data/lib/generators/active_record/templates/migration.rb +18 -0
- data/lib/generators/devise_authy/devise_authy_generator.rb +30 -0
- data/lib/generators/devise_authy/install_generator.rb +64 -0
- data/spec/controllers/devise_authy_controller_spec.rb +85 -0
- data/spec/generators_spec.rb +24 -0
- data/spec/integration/authy_authenticatable.rb +88 -0
- data/spec/models/authy_authenticatable.rb +17 -0
- data/spec/orm/active_record.rb +4 -0
- data/spec/rails_app/Rakefile +10 -0
- data/spec/rails_app/app/assets/images/rails.png +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +10 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +9 -0
- data/spec/rails_app/app/assets/stylesheets/devise_authy.css +26 -0
- data/spec/rails_app/app/assets/stylesheets/devise_authy.css.scss +26 -0
- data/spec/rails_app/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/spec/rails_app/app/controllers/application_controller.rb +4 -0
- data/spec/rails_app/app/controllers/posts_controller.rb +83 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/helpers/posts_helper.rb +2 -0
- data/spec/rails_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_app/app/models/.gitkeep +0 -0
- data/spec/rails_app/app/models/post.rb +2 -0
- data/spec/rails_app/app/models/user.rb +9 -0
- data/spec/rails_app/app/views/devise/devise_authy/register.html.erb +10 -0
- data/spec/rails_app/app/views/devise/devise_authy/show.html.erb +10 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +24 -0
- data/spec/rails_app/app/views/posts/_form.html.erb +25 -0
- data/spec/rails_app/app/views/posts/edit.html.erb +6 -0
- data/spec/rails_app/app/views/posts/index.html.erb +27 -0
- data/spec/rails_app/app/views/posts/new.html.erb +5 -0
- data/spec/rails_app/app/views/posts/show.html.erb +15 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +33 -0
- data/spec/rails_app/config/boot.rb +7 -0
- data/spec/rails_app/config/database.yml +22 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +37 -0
- data/spec/rails_app/config/environments/production.rb +67 -0
- data/spec/rails_app/config/environments/test.rb +37 -0
- data/spec/rails_app/config/initializers/authy.rb +3 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/devise.rb +237 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/devise.authy.en.yml +14 -0
- data/spec/rails_app/config/routes.rb +6 -0
- data/spec/rails_app/db/migrate/20121029205626_devise_create_users.rb +32 -0
- data/spec/rails_app/db/migrate/20121029205627_create_posts.rb +10 -0
- data/spec/rails_app/db/migrate/20121029205628_devise_authy_add_to_users.rb +15 -0
- data/spec/rails_app/db/schema.rb +43 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/routing/routes_spec.rb +19 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/support/helpers.rb +28 -0
- metadata +367 -0
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/performance_test_help'
|
3
|
+
|
4
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
5
|
+
# Refer to the documentation for all available options
|
6
|
+
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
|
7
|
+
# :output => 'tmp/performance', :formats => [:flat] }
|
8
|
+
|
9
|
+
def test_homepage
|
10
|
+
get '/'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
en:
|
2
|
+
devise:
|
3
|
+
submit_token: "Check Token"
|
4
|
+
submit_token_title: "Please enter your Authy token:"
|
5
|
+
authy_register_title: 'Enable Two factor authentication'
|
6
|
+
enable_authy: 'Enable'
|
7
|
+
cellphone: 'Enter your cellphone'
|
8
|
+
country: 'Enter you country'
|
9
|
+
request_sms: 'Request SMS'
|
10
|
+
|
11
|
+
authy_verify_installation_title: "Verify your account"
|
12
|
+
enable_my_account: 'Enable my account'
|
13
|
+
|
14
|
+
devise_authy:
|
15
|
+
user:
|
16
|
+
enabled: 'Two factor authentication was enable'
|
17
|
+
not_enabled: 'Something went wrong while enabling two factor authentication'
|
18
|
+
signed_in: 'Signed in with Authy successfully.'
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "devise-authy"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Authy Inc."]
|
12
|
+
s.date = "2013-04-10"
|
13
|
+
s.description = "Authy plugin for Devise"
|
14
|
+
s.email = "support@authy.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"app/assets/javascripts/devise_authy.js",
|
29
|
+
"app/assets/stylesheets/devise_authy.css",
|
30
|
+
"app/assets/stylesheets/devise_authy.sass",
|
31
|
+
"app/controllers/devise/devise_authy_controller.rb",
|
32
|
+
"app/views/devise/enable_authy.html.erb",
|
33
|
+
"app/views/devise/enable_authy.html.haml",
|
34
|
+
"app/views/devise/verify_authy.html.erb",
|
35
|
+
"app/views/devise/verify_authy.html.haml",
|
36
|
+
"app/views/devise/verify_authy_installation.html.erb",
|
37
|
+
"app/views/devise/verify_authy_installation.html.haml",
|
38
|
+
"authy-devise-demo/.gitignore",
|
39
|
+
"authy-devise-demo/Gemfile",
|
40
|
+
"authy-devise-demo/Gemfile.lock",
|
41
|
+
"authy-devise-demo/README.md",
|
42
|
+
"authy-devise-demo/Rakefile",
|
43
|
+
"authy-devise-demo/app/assets/images/rails.png",
|
44
|
+
"authy-devise-demo/app/assets/javascripts/application.js",
|
45
|
+
"authy-devise-demo/app/assets/javascripts/devise_authy.js",
|
46
|
+
"authy-devise-demo/app/assets/javascripts/welcome.js.coffee",
|
47
|
+
"authy-devise-demo/app/assets/stylesheets/application.css",
|
48
|
+
"authy-devise-demo/app/assets/stylesheets/devise_authy.css",
|
49
|
+
"authy-devise-demo/app/assets/stylesheets/welcome.css.scss",
|
50
|
+
"authy-devise-demo/app/controllers/application_controller.rb",
|
51
|
+
"authy-devise-demo/app/controllers/welcome_controller.rb",
|
52
|
+
"authy-devise-demo/app/helpers/application_helper.rb",
|
53
|
+
"authy-devise-demo/app/helpers/welcome_helper.rb",
|
54
|
+
"authy-devise-demo/app/mailers/.gitkeep",
|
55
|
+
"authy-devise-demo/app/models/.gitkeep",
|
56
|
+
"authy-devise-demo/app/models/user.rb",
|
57
|
+
"authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb",
|
58
|
+
"authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb",
|
59
|
+
"authy-devise-demo/app/views/devise/devise_authy/verify_authy_installation.html.erb",
|
60
|
+
"authy-devise-demo/app/views/layouts/application.html.erb",
|
61
|
+
"authy-devise-demo/app/views/welcome/index.html.erb",
|
62
|
+
"authy-devise-demo/config.ru",
|
63
|
+
"authy-devise-demo/config/application.rb",
|
64
|
+
"authy-devise-demo/config/boot.rb",
|
65
|
+
"authy-devise-demo/config/database.yml",
|
66
|
+
"authy-devise-demo/config/environment.rb",
|
67
|
+
"authy-devise-demo/config/environments/development.rb",
|
68
|
+
"authy-devise-demo/config/environments/production.rb",
|
69
|
+
"authy-devise-demo/config/environments/test.rb",
|
70
|
+
"authy-devise-demo/config/initializers/authy.rb",
|
71
|
+
"authy-devise-demo/config/initializers/backtrace_silencers.rb",
|
72
|
+
"authy-devise-demo/config/initializers/devise.rb",
|
73
|
+
"authy-devise-demo/config/initializers/inflections.rb",
|
74
|
+
"authy-devise-demo/config/initializers/mime_types.rb",
|
75
|
+
"authy-devise-demo/config/initializers/secret_token.rb",
|
76
|
+
"authy-devise-demo/config/initializers/session_store.rb",
|
77
|
+
"authy-devise-demo/config/initializers/wrap_parameters.rb",
|
78
|
+
"authy-devise-demo/config/locales/devise.authy.en.yml",
|
79
|
+
"authy-devise-demo/config/locales/devise.en.yml",
|
80
|
+
"authy-devise-demo/config/locales/en.yml",
|
81
|
+
"authy-devise-demo/config/routes.rb",
|
82
|
+
"authy-devise-demo/db/migrate/20130409234357_devise_create_users.rb",
|
83
|
+
"authy-devise-demo/db/migrate/20130409234434_devise_authy_add_to_users.rb",
|
84
|
+
"authy-devise-demo/db/schema.rb",
|
85
|
+
"authy-devise-demo/db/seeds.rb",
|
86
|
+
"authy-devise-demo/lib/assets/.gitkeep",
|
87
|
+
"authy-devise-demo/lib/tasks/.gitkeep",
|
88
|
+
"authy-devise-demo/log/.gitkeep",
|
89
|
+
"authy-devise-demo/public/404.html",
|
90
|
+
"authy-devise-demo/public/422.html",
|
91
|
+
"authy-devise-demo/public/500.html",
|
92
|
+
"authy-devise-demo/public/favicon.ico",
|
93
|
+
"authy-devise-demo/public/robots.txt",
|
94
|
+
"authy-devise-demo/script/rails",
|
95
|
+
"authy-devise-demo/test/fixtures/.gitkeep",
|
96
|
+
"authy-devise-demo/test/fixtures/users.yml",
|
97
|
+
"authy-devise-demo/test/functional/.gitkeep",
|
98
|
+
"authy-devise-demo/test/functional/welcome_controller_test.rb",
|
99
|
+
"authy-devise-demo/test/integration/.gitkeep",
|
100
|
+
"authy-devise-demo/test/performance/browsing_test.rb",
|
101
|
+
"authy-devise-demo/test/test_helper.rb",
|
102
|
+
"authy-devise-demo/test/unit/.gitkeep",
|
103
|
+
"authy-devise-demo/test/unit/helpers/welcome_helper_test.rb",
|
104
|
+
"authy-devise-demo/test/unit/user_test.rb",
|
105
|
+
"authy-devise-demo/vendor/assets/javascripts/.gitkeep",
|
106
|
+
"authy-devise-demo/vendor/assets/stylesheets/.gitkeep",
|
107
|
+
"authy-devise-demo/vendor/plugins/.gitkeep",
|
108
|
+
"config/locales/en.yml",
|
109
|
+
"devise-authy.gemspec",
|
110
|
+
"lib/devise-authy.rb",
|
111
|
+
"lib/devise-authy/controllers/helpers.rb",
|
112
|
+
"lib/devise-authy/controllers/view_helpers.rb",
|
113
|
+
"lib/devise-authy/hooks/authy_authenticatable.rb",
|
114
|
+
"lib/devise-authy/models/authy_authenticatable.rb",
|
115
|
+
"lib/devise-authy/rails.rb",
|
116
|
+
"lib/devise-authy/routes.rb",
|
117
|
+
"lib/devise-authy/version.rb",
|
118
|
+
"lib/generators/active_record/devise_authy_generator.rb",
|
119
|
+
"lib/generators/active_record/templates/migration.rb",
|
120
|
+
"lib/generators/devise_authy/devise_authy_generator.rb",
|
121
|
+
"lib/generators/devise_authy/install_generator.rb",
|
122
|
+
"spec/controllers/devise_authy_controller_spec.rb",
|
123
|
+
"spec/generators_spec.rb",
|
124
|
+
"spec/integration/authy_authenticatable.rb",
|
125
|
+
"spec/models/authy_authenticatable.rb",
|
126
|
+
"spec/orm/active_record.rb",
|
127
|
+
"spec/rails_app/Rakefile",
|
128
|
+
"spec/rails_app/app/assets/images/rails.png",
|
129
|
+
"spec/rails_app/app/assets/javascripts/application.js",
|
130
|
+
"spec/rails_app/app/assets/stylesheets/application.css",
|
131
|
+
"spec/rails_app/app/assets/stylesheets/devise_authy.css",
|
132
|
+
"spec/rails_app/app/assets/stylesheets/devise_authy.css.scss",
|
133
|
+
"spec/rails_app/app/assets/stylesheets/scaffolds.css.scss",
|
134
|
+
"spec/rails_app/app/controllers/application_controller.rb",
|
135
|
+
"spec/rails_app/app/controllers/posts_controller.rb",
|
136
|
+
"spec/rails_app/app/helpers/application_helper.rb",
|
137
|
+
"spec/rails_app/app/helpers/posts_helper.rb",
|
138
|
+
"spec/rails_app/app/mailers/.gitkeep",
|
139
|
+
"spec/rails_app/app/models/.gitkeep",
|
140
|
+
"spec/rails_app/app/models/post.rb",
|
141
|
+
"spec/rails_app/app/models/user.rb",
|
142
|
+
"spec/rails_app/app/views/devise/devise_authy/register.html.erb",
|
143
|
+
"spec/rails_app/app/views/devise/devise_authy/show.html.erb",
|
144
|
+
"spec/rails_app/app/views/layouts/application.html.erb",
|
145
|
+
"spec/rails_app/app/views/posts/_form.html.erb",
|
146
|
+
"spec/rails_app/app/views/posts/edit.html.erb",
|
147
|
+
"spec/rails_app/app/views/posts/index.html.erb",
|
148
|
+
"spec/rails_app/app/views/posts/new.html.erb",
|
149
|
+
"spec/rails_app/app/views/posts/show.html.erb",
|
150
|
+
"spec/rails_app/config.ru",
|
151
|
+
"spec/rails_app/config/application.rb",
|
152
|
+
"spec/rails_app/config/boot.rb",
|
153
|
+
"spec/rails_app/config/database.yml",
|
154
|
+
"spec/rails_app/config/environment.rb",
|
155
|
+
"spec/rails_app/config/environments/development.rb",
|
156
|
+
"spec/rails_app/config/environments/production.rb",
|
157
|
+
"spec/rails_app/config/environments/test.rb",
|
158
|
+
"spec/rails_app/config/initializers/authy.rb",
|
159
|
+
"spec/rails_app/config/initializers/backtrace_silencers.rb",
|
160
|
+
"spec/rails_app/config/initializers/devise.rb",
|
161
|
+
"spec/rails_app/config/initializers/inflections.rb",
|
162
|
+
"spec/rails_app/config/initializers/mime_types.rb",
|
163
|
+
"spec/rails_app/config/initializers/secret_token.rb",
|
164
|
+
"spec/rails_app/config/initializers/session_store.rb",
|
165
|
+
"spec/rails_app/config/initializers/wrap_parameters.rb",
|
166
|
+
"spec/rails_app/config/locales/devise.authy.en.yml",
|
167
|
+
"spec/rails_app/config/routes.rb",
|
168
|
+
"spec/rails_app/db/migrate/20121029205626_devise_create_users.rb",
|
169
|
+
"spec/rails_app/db/migrate/20121029205627_create_posts.rb",
|
170
|
+
"spec/rails_app/db/migrate/20121029205628_devise_authy_add_to_users.rb",
|
171
|
+
"spec/rails_app/db/schema.rb",
|
172
|
+
"spec/rails_app/public/favicon.ico",
|
173
|
+
"spec/rails_app/script/rails",
|
174
|
+
"spec/routing/routes_spec.rb",
|
175
|
+
"spec/spec_helper.rb",
|
176
|
+
"spec/support/helpers.rb"
|
177
|
+
]
|
178
|
+
s.homepage = "http://github.com/senekis/devise-authy"
|
179
|
+
s.licenses = ["MIT"]
|
180
|
+
s.require_paths = ["lib"]
|
181
|
+
s.rubygems_version = "1.8.24"
|
182
|
+
s.summary = "Authy plugin for Devise"
|
183
|
+
|
184
|
+
if s.respond_to? :specification_version then
|
185
|
+
s.specification_version = 3
|
186
|
+
|
187
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
188
|
+
s.add_runtime_dependency(%q<devise>, [">= 0"])
|
189
|
+
s.add_runtime_dependency(%q<authy>, [">= 0"])
|
190
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
191
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
192
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
193
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
194
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
195
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
196
|
+
s.add_development_dependency(%q<sass-rails>, [">= 0"])
|
197
|
+
s.add_development_dependency(%q<jquery-rails>, [">= 0"])
|
198
|
+
else
|
199
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
200
|
+
s.add_dependency(%q<authy>, [">= 0"])
|
201
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
202
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
203
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
204
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
205
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
206
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
207
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
208
|
+
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
209
|
+
end
|
210
|
+
else
|
211
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
212
|
+
s.add_dependency(%q<authy>, [">= 0"])
|
213
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
214
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
215
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
216
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
217
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
218
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
219
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
220
|
+
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
data/lib/devise-authy.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'devise-authy/version'
|
3
|
+
require 'devise'
|
4
|
+
require 'authy'
|
5
|
+
|
6
|
+
module Devise
|
7
|
+
end
|
8
|
+
|
9
|
+
module DeviseAuthy
|
10
|
+
module Controllers
|
11
|
+
autoload :Helpers, 'devise-authy/controllers/helpers'
|
12
|
+
end
|
13
|
+
module Views
|
14
|
+
autoload :Helpers, 'devise-authy/controllers/view_helpers'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'devise-authy/routes'
|
19
|
+
require 'devise-authy/rails'
|
20
|
+
require 'devise-authy/models/authy_authenticatable'
|
21
|
+
|
22
|
+
Devise.add_module :authy_authenticatable, :model => 'devise-authy/models/authy_authenticatable', :controller => :devise_authy, :route => :authy
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module DeviseAuthy
|
2
|
+
module Controllers
|
3
|
+
module Helpers
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
before_filter :check_request_and_redirect_to_verify_token
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def check_request_and_redirect_to_verify_token
|
13
|
+
if devise_controller? && !request.format.nil? && request.format.html?
|
14
|
+
Devise.mappings.keys.flatten.any? do |scope|
|
15
|
+
if signed_in?(scope) && warden.session(scope)[:with_authy_authentication]
|
16
|
+
# login with 2fa
|
17
|
+
id = warden.session(scope)[:id]
|
18
|
+
warden.logout
|
19
|
+
warden.reset_session! # make sure the session resetted
|
20
|
+
session["#{scope}_id"] = id
|
21
|
+
# this is safe to put in the session because the cookie is signed
|
22
|
+
session["#{scope}_password_checked"] = true
|
23
|
+
session["#{scope}_return_to"] = request.path if request.get?
|
24
|
+
|
25
|
+
redirect_to verify_authy_path_for(scope)
|
26
|
+
return
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def verify_authy_path_for(resource_or_scope = nil)
|
33
|
+
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
34
|
+
send("#{scope}_verify_authy_path")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module DeviseAuthy
|
2
|
+
module Views
|
3
|
+
module Helpers
|
4
|
+
|
5
|
+
def authy_request_sms_link
|
6
|
+
link_to(
|
7
|
+
I18n.t('request_sms', {:scope => 'devise'}),
|
8
|
+
url_for([resource_name, :request_sms]),
|
9
|
+
:id => "authy-request-sms-link",
|
10
|
+
:method => :post,
|
11
|
+
:remote => true
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def verify_authy_form(&block)
|
16
|
+
form_tag([resource_name, :verify_authy], {:id => 'devise_authy', :method => :post}) do
|
17
|
+
buffer = hidden_field_tag(:"#{resource_name}_id", @resource.id)
|
18
|
+
buffer << capture(&block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def enable_authy_form(&block)
|
23
|
+
form_tag([resource_name, :enable_authy], :method => :post) do
|
24
|
+
capture(&block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def verify_authy_installation_form(&block)
|
29
|
+
form_tag([resource_name, :verify_authy_installation], :method => :post) do
|
30
|
+
capture(&block)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Warden::Manager.after_authentication do |user, auth, options|
|
2
|
+
if user.respond_to?(:with_authy_authentication?)
|
3
|
+
if auth.session(options[:scope])[:with_authy_authentication] = user.with_authy_authentication?(auth.request)
|
4
|
+
auth.session(options[:scope])[:id] = user.id
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'devise-authy/hooks/authy_authenticatable'
|
2
|
+
module Devise
|
3
|
+
module Models
|
4
|
+
module AuthyAuthenticatable
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def with_authy_authentication?(request)
|
8
|
+
if self.authy_id.present? && self.authy_enabled
|
9
|
+
return true
|
10
|
+
end
|
11
|
+
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def find_by_authy_id(authy_id)
|
17
|
+
find(:first, :conditions => {:authy_id => authy_id})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
protected
|
4
|
+
|
5
|
+
def devise_authy(mapping, controllers)
|
6
|
+
match "/#{mapping.path_names[:verify_authy]}", :controller => controllers[:devise_authy], :action => :GET_verify_authy, :as => :verify_authy, :via => :get
|
7
|
+
match "/#{mapping.path_names[:verify_authy]}", :controller => controllers[:devise_authy], :action => :POST_verify_authy, :as => :verify_authy, :via => :post
|
8
|
+
|
9
|
+
match "/#{mapping.path_names[:enable_authy]}", :controller => controllers[:devise_authy], :action => :GET_enable_authy, :as => :enable_authy, :via => :get
|
10
|
+
match "/#{mapping.path_names[:enable_authy]}", :controller => controllers[:devise_authy], :action => :POST_enable_authy, :as => :enable_authy, :via => :post
|
11
|
+
|
12
|
+
match "/#{mapping.path_names[:verify_authy_installation]}", :controller => controllers[:devise_authy], :action => :GET_verify_authy_installation, :as => :verify_authy_installation, :via => :get
|
13
|
+
match "/#{mapping.path_names[:verify_authy_installation]}", :controller => controllers[:devise_authy], :action => :POST_verify_authy_installation, :as => :verify_authy_installation, :via => :post
|
14
|
+
|
15
|
+
|
16
|
+
match "/request-sms", :controller => controllers[:devise_authy], :action => :request_sms, :as => :request_sms, :via => :post
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|