orthodox 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +3 -7
- data/dummy/.ruby-version +1 -1
- data/dummy/Gemfile +2 -2
- data/dummy/Gemfile.lock +111 -113
- data/lib/generators/authentication/templates/controllers/concerns/authentication.rb.erb +24 -24
- data/lib/generators/authentication/templates/controllers/sessions_controller.rb.erb +4 -4
- data/lib/generators/authentication/templates/controllers/tfa_sessions_controller.rb.erb +2 -2
- data/lib/generators/authentication/templates/controllers/tfas_controller.rb.erb +2 -2
- data/lib/generators/authentication/templates/helpers/otp_credentials_helper.rb +2 -2
- data/lib/generators/authentication/templates/javascript/tfa_forms.js +3 -5
- data/lib/generators/authentication/templates/models/concerns/authenticateable.rb +2 -2
- data/lib/generators/authentication/templates/models/concerns/otpable.rb +2 -2
- data/lib/generators/authentication/templates/models/concerns/password_resetable.rb +2 -2
- data/lib/generators/authentication/templates/models/otp_credential.rb.erb +2 -2
- data/lib/generators/authentication/templates/models/password_reset_token.rb +2 -2
- data/lib/generators/authentication/templates/models/session.rb.erb +2 -2
- data/lib/generators/authentication/templates/models/tfa_session.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/otp_credential_spec.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/password_reset_token_spec.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/session_spec.rb.erb +10 -11
- data/lib/generators/authentication/templates/spec/models/tfa_session_spec.rb.erb +35 -36
- data/lib/generators/authentication/templates/spec/support/authentication_helpers.rb +2 -2
- data/lib/generators/authentication/templates/spec/system/authentication_spec.rb.erb +2 -2
- data/lib/generators/authentication/templates/spec/system/password_resets_spec.rb.erb +2 -2
- data/lib/generators/authentication/templates/spec/system/tfa_authentication_spec.rb.erb +2 -2
- data/lib/orthodox/version.rb +1 -1
- data/orthodox.gemspec +1 -2
- metadata +6 -52
- data/docs/Authenticateable/ClassMethods.html +0 -105
- data/docs/Authenticateable.html +0 -246
- data/docs/AuthenticationGenerator.html +0 -1335
- data/docs/AuthenticationHelpers.html +0 -194
- data/docs/BaseControllerGenerator.html +0 -247
- data/docs/CoffeescriptGenerator.html +0 -495
- data/docs/ControllerGenerator.html +0 -855
- data/docs/LayoutHelperGenerator.html +0 -397
- data/docs/Orthodox/Railtie.html +0 -124
- data/docs/Orthodox.html +0 -133
- data/docs/OtpCredentialsHelper.html +0 -298
- data/docs/Otpable.html +0 -267
- data/docs/PasswordResetToken.html +0 -324
- data/docs/PasswordResetable.html +0 -193
- data/docs/SassGenerator.html +0 -549
- data/docs/TfaSession.html +0 -476
- data/docs/TwoFactorAuthentication/ClassMethods.html +0 -222
- data/docs/TwoFactorAuthentication.html +0 -121
- data/docs/_config.yml +0 -1
- data/docs/_index.html +0 -265
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.README.html +0 -311
- data/docs/file_list.html +0 -56
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -311
- data/docs/js/app.js +0 -314
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -555
- data/docs/top-level-namespace.html +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c5e870047ab45a759e21ac5225ce347f234740f338fb0aa42c175a3d919bc2
|
4
|
+
data.tar.gz: c2452520df415c86c88e3f9bacf77f87b7b0109cccc71585422be9375d93210c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b8cc69600b87f8a90b1d8999616930eb8fd54d7a93f5db1aaf48ed72a23ea94d9285b8bcc08ca2b8dfbba188d40069d08cb42b1ec74fd1003fc91409df771e4
|
7
|
+
data.tar.gz: 66682e2c0fc311d0b7d3522e2c5c83236c2c3a0aa10202c616a6987c1ce4d349d1b0e4cdcbb9e74a19f64e4ead2b7a127cdafef81161c867afbe1438a4e02da3
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.2
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Orthodox
|
2
2
|
|
3
|
-
|
3
|
+
Better Rails generators for modern apps
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'orthodox', github: "
|
10
|
+
gem 'orthodox', github: "bodacious/orthodox"
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -214,12 +214,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
214
214
|
|
215
215
|
## Contributing
|
216
216
|
|
217
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
217
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bodacious/orthodox.
|
218
218
|
|
219
219
|
## License
|
220
220
|
|
221
221
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
222
|
-
|
223
|
-
## About Katana
|
224
|
-
|
225
|
-
Katana are [web and mobile app developers in Edinburgh, Scotland](http://katanacode.com/ "Katana Code").
|
data/dummy/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/dummy/Gemfile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
3
|
|
4
|
-
ruby '2.
|
4
|
+
ruby '2.7.2'
|
5
5
|
|
6
6
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
7
7
|
gem 'rails', '~> 5.2.0'
|
8
8
|
# Use sqlite3 as the database for Active Record
|
9
9
|
gem 'sqlite3'
|
10
10
|
# Use Puma as the app server
|
11
|
-
gem 'puma', '~>
|
11
|
+
gem 'puma', '~> 5.0'
|
12
12
|
# Use SCSS for stylesheets
|
13
13
|
gem 'sass-rails', '~> 5.0'
|
14
14
|
# Use Uglifier as compressor for JavaScript assets
|
data/dummy/Gemfile.lock
CHANGED
@@ -1,74 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
orthodox (0.
|
4
|
+
orthodox (0.3.5)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
slim-rails
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (5.2.
|
12
|
-
actionpack (= 5.2.
|
11
|
+
actioncable (5.2.6)
|
12
|
+
actionpack (= 5.2.6)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailer (5.2.
|
16
|
-
actionpack (= 5.2.
|
17
|
-
actionview (= 5.2.
|
18
|
-
activejob (= 5.2.
|
15
|
+
actionmailer (5.2.6)
|
16
|
+
actionpack (= 5.2.6)
|
17
|
+
actionview (= 5.2.6)
|
18
|
+
activejob (= 5.2.6)
|
19
19
|
mail (~> 2.5, >= 2.5.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.2.
|
22
|
-
actionview (= 5.2.
|
23
|
-
activesupport (= 5.2.
|
24
|
-
rack (~> 2.0)
|
21
|
+
actionpack (5.2.6)
|
22
|
+
actionview (= 5.2.6)
|
23
|
+
activesupport (= 5.2.6)
|
24
|
+
rack (~> 2.0, >= 2.0.8)
|
25
25
|
rack-test (>= 0.6.3)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
27
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.2.
|
29
|
-
activesupport (= 5.2.
|
28
|
+
actionview (5.2.6)
|
29
|
+
activesupport (= 5.2.6)
|
30
30
|
builder (~> 3.1)
|
31
31
|
erubi (~> 1.4)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
33
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.2.
|
35
|
-
activesupport (= 5.2.
|
34
|
+
activejob (5.2.6)
|
35
|
+
activesupport (= 5.2.6)
|
36
36
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.2.
|
38
|
-
activesupport (= 5.2.
|
39
|
-
activerecord (5.2.
|
40
|
-
activemodel (= 5.2.
|
41
|
-
activesupport (= 5.2.
|
37
|
+
activemodel (5.2.6)
|
38
|
+
activesupport (= 5.2.6)
|
39
|
+
activerecord (5.2.6)
|
40
|
+
activemodel (= 5.2.6)
|
41
|
+
activesupport (= 5.2.6)
|
42
42
|
arel (>= 9.0)
|
43
|
-
activestorage (5.2.
|
44
|
-
actionpack (= 5.2.
|
45
|
-
activerecord (= 5.2.
|
46
|
-
marcel (~> 0.
|
47
|
-
activesupport (5.2.
|
43
|
+
activestorage (5.2.6)
|
44
|
+
actionpack (= 5.2.6)
|
45
|
+
activerecord (= 5.2.6)
|
46
|
+
marcel (~> 1.0.0)
|
47
|
+
activesupport (5.2.6)
|
48
48
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
49
|
i18n (>= 0.7, < 2)
|
50
50
|
minitest (~> 5.1)
|
51
51
|
tzinfo (~> 1.1)
|
52
|
-
addressable (2.
|
53
|
-
public_suffix (>= 2.0.2, <
|
54
|
-
archive-zip (0.
|
52
|
+
addressable (2.8.0)
|
53
|
+
public_suffix (>= 2.0.2, < 5.0)
|
54
|
+
archive-zip (0.12.0)
|
55
55
|
io-like (~> 0.3.0)
|
56
56
|
arel (9.0.0)
|
57
|
-
bindex (0.
|
58
|
-
bootsnap (1.
|
57
|
+
bindex (0.8.1)
|
58
|
+
bootsnap (1.9.1)
|
59
59
|
msgpack (~> 1.0)
|
60
|
-
builder (3.2.
|
61
|
-
byebug (
|
62
|
-
capybara (3.3
|
60
|
+
builder (3.2.4)
|
61
|
+
byebug (11.1.3)
|
62
|
+
capybara (3.35.3)
|
63
63
|
addressable
|
64
64
|
mini_mime (>= 0.1.3)
|
65
65
|
nokogiri (~> 1.8)
|
66
66
|
rack (>= 1.6.0)
|
67
67
|
rack-test (>= 0.6.3)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
chromedriver-helper (1.
|
68
|
+
regexp_parser (>= 1.5, < 3.0)
|
69
|
+
xpath (~> 3.2)
|
70
|
+
childprocess (3.0.0)
|
71
|
+
chromedriver-helper (2.1.1)
|
72
72
|
archive-zip (~> 0.10)
|
73
73
|
nokogiri (~> 1.8)
|
74
74
|
coffee-rails (4.2.2)
|
@@ -78,130 +78,128 @@ GEM
|
|
78
78
|
coffee-script-source
|
79
79
|
execjs
|
80
80
|
coffee-script-source (1.12.2)
|
81
|
-
concurrent-ruby (1.1.
|
82
|
-
crass (1.0.
|
83
|
-
erubi (1.
|
84
|
-
execjs (2.
|
85
|
-
ffi (1.
|
86
|
-
globalid (0.
|
87
|
-
activesupport (>=
|
88
|
-
i18n (1.
|
81
|
+
concurrent-ruby (1.1.9)
|
82
|
+
crass (1.0.6)
|
83
|
+
erubi (1.10.0)
|
84
|
+
execjs (2.8.1)
|
85
|
+
ffi (1.15.4)
|
86
|
+
globalid (0.5.2)
|
87
|
+
activesupport (>= 5.0)
|
88
|
+
i18n (1.8.10)
|
89
89
|
concurrent-ruby (~> 1.0)
|
90
|
-
io-like (0.3.
|
91
|
-
jbuilder (2.
|
92
|
-
activesupport (>=
|
93
|
-
multi_json (>= 1.2)
|
90
|
+
io-like (0.3.1)
|
91
|
+
jbuilder (2.11.2)
|
92
|
+
activesupport (>= 5.0.0)
|
94
93
|
listen (3.1.5)
|
95
94
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
96
95
|
rb-inotify (~> 0.9, >= 0.9.7)
|
97
96
|
ruby_dep (~> 1.2)
|
98
|
-
loofah (2.
|
97
|
+
loofah (2.12.0)
|
99
98
|
crass (~> 1.0.2)
|
100
99
|
nokogiri (>= 1.5.9)
|
101
100
|
mail (2.7.1)
|
102
101
|
mini_mime (>= 0.1.1)
|
103
|
-
marcel (0.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
public_suffix (3.0.2)
|
116
|
-
puma (4.3.1)
|
102
|
+
marcel (1.0.2)
|
103
|
+
method_source (1.0.0)
|
104
|
+
mini_mime (1.1.1)
|
105
|
+
mini_portile2 (2.6.1)
|
106
|
+
minitest (5.14.4)
|
107
|
+
msgpack (1.4.2)
|
108
|
+
nio4r (2.5.8)
|
109
|
+
nokogiri (1.12.5)
|
110
|
+
mini_portile2 (~> 2.6.1)
|
111
|
+
racc (~> 1.4)
|
112
|
+
public_suffix (4.0.6)
|
113
|
+
puma (5.5.0)
|
117
114
|
nio4r (~> 2.0)
|
118
|
-
|
115
|
+
racc (1.5.2)
|
116
|
+
rack (2.2.3)
|
119
117
|
rack-test (1.1.0)
|
120
118
|
rack (>= 1.0, < 3)
|
121
|
-
rails (5.2.
|
122
|
-
actioncable (= 5.2.
|
123
|
-
actionmailer (= 5.2.
|
124
|
-
actionpack (= 5.2.
|
125
|
-
actionview (= 5.2.
|
126
|
-
activejob (= 5.2.
|
127
|
-
activemodel (= 5.2.
|
128
|
-
activerecord (= 5.2.
|
129
|
-
activestorage (= 5.2.
|
130
|
-
activesupport (= 5.2.
|
119
|
+
rails (5.2.6)
|
120
|
+
actioncable (= 5.2.6)
|
121
|
+
actionmailer (= 5.2.6)
|
122
|
+
actionpack (= 5.2.6)
|
123
|
+
actionview (= 5.2.6)
|
124
|
+
activejob (= 5.2.6)
|
125
|
+
activemodel (= 5.2.6)
|
126
|
+
activerecord (= 5.2.6)
|
127
|
+
activestorage (= 5.2.6)
|
128
|
+
activesupport (= 5.2.6)
|
131
129
|
bundler (>= 1.3.0)
|
132
|
-
railties (= 5.2.
|
130
|
+
railties (= 5.2.6)
|
133
131
|
sprockets-rails (>= 2.0.0)
|
134
132
|
rails-dom-testing (2.0.3)
|
135
133
|
activesupport (>= 4.2.0)
|
136
134
|
nokogiri (>= 1.6)
|
137
|
-
rails-html-sanitizer (1.
|
138
|
-
loofah (~> 2.
|
139
|
-
railties (5.2.
|
140
|
-
actionpack (= 5.2.
|
141
|
-
activesupport (= 5.2.
|
135
|
+
rails-html-sanitizer (1.4.2)
|
136
|
+
loofah (~> 2.3)
|
137
|
+
railties (5.2.6)
|
138
|
+
actionpack (= 5.2.6)
|
139
|
+
activesupport (= 5.2.6)
|
142
140
|
method_source
|
143
141
|
rake (>= 0.8.7)
|
144
142
|
thor (>= 0.19.0, < 2.0)
|
145
|
-
rake (
|
146
|
-
rb-fsevent (0.
|
147
|
-
rb-inotify (0.
|
148
|
-
ffi (
|
143
|
+
rake (13.0.6)
|
144
|
+
rb-fsevent (0.11.0)
|
145
|
+
rb-inotify (0.10.1)
|
146
|
+
ffi (~> 1.0)
|
147
|
+
regexp_parser (2.1.1)
|
149
148
|
ruby_dep (1.5.0)
|
150
|
-
rubyzip (
|
151
|
-
sass (3.
|
149
|
+
rubyzip (2.3.2)
|
150
|
+
sass (3.7.4)
|
152
151
|
sass-listen (~> 4.0.0)
|
153
152
|
sass-listen (4.0.0)
|
154
153
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
155
154
|
rb-inotify (~> 0.9, >= 0.9.7)
|
156
|
-
sass-rails (5.0
|
157
|
-
railties (>=
|
155
|
+
sass-rails (5.1.0)
|
156
|
+
railties (>= 5.2.0)
|
158
157
|
sass (~> 3.1)
|
159
158
|
sprockets (>= 2.8, < 4.0)
|
160
159
|
sprockets-rails (>= 2.0, < 4.0)
|
161
160
|
tilt (>= 1.1, < 3)
|
162
|
-
selenium-webdriver (3.
|
163
|
-
childprocess (
|
164
|
-
rubyzip (
|
165
|
-
slim (4.0
|
161
|
+
selenium-webdriver (3.142.7)
|
162
|
+
childprocess (>= 0.5, < 4.0)
|
163
|
+
rubyzip (>= 1.2.2)
|
164
|
+
slim (4.1.0)
|
166
165
|
temple (>= 0.7.6, < 0.9)
|
167
166
|
tilt (>= 2.0.6, < 2.1)
|
168
|
-
slim-rails (3.
|
167
|
+
slim-rails (3.3.0)
|
169
168
|
actionpack (>= 3.1)
|
170
169
|
railties (>= 3.1)
|
171
170
|
slim (>= 3.0, < 5.0)
|
172
|
-
spring (2.
|
173
|
-
activesupport (>= 4.2)
|
171
|
+
spring (2.1.1)
|
174
172
|
spring-watcher-listen (2.0.1)
|
175
173
|
listen (>= 2.7, < 4.0)
|
176
174
|
spring (>= 1.2, < 3.0)
|
177
175
|
sprockets (3.7.2)
|
178
176
|
concurrent-ruby (~> 1.0)
|
179
177
|
rack (> 1, < 3)
|
180
|
-
sprockets-rails (3.2.
|
178
|
+
sprockets-rails (3.2.2)
|
181
179
|
actionpack (>= 4.0)
|
182
180
|
activesupport (>= 4.0)
|
183
181
|
sprockets (>= 3.0.0)
|
184
|
-
sqlite3 (1.
|
185
|
-
temple (0.8.
|
186
|
-
thor (
|
182
|
+
sqlite3 (1.4.2)
|
183
|
+
temple (0.8.2)
|
184
|
+
thor (1.1.0)
|
187
185
|
thread_safe (0.3.6)
|
188
|
-
tilt (2.0.
|
189
|
-
turbolinks (5.
|
190
|
-
turbolinks-source (~> 5.
|
191
|
-
turbolinks-source (5.
|
192
|
-
tzinfo (1.2.
|
186
|
+
tilt (2.0.10)
|
187
|
+
turbolinks (5.2.1)
|
188
|
+
turbolinks-source (~> 5.2)
|
189
|
+
turbolinks-source (5.2.0)
|
190
|
+
tzinfo (1.2.9)
|
193
191
|
thread_safe (~> 0.1)
|
194
|
-
uglifier (4.
|
192
|
+
uglifier (4.2.0)
|
195
193
|
execjs (>= 0.3.0, < 3)
|
196
|
-
web-console (3.
|
194
|
+
web-console (3.7.0)
|
197
195
|
actionview (>= 5.0)
|
198
196
|
activemodel (>= 5.0)
|
199
197
|
bindex (>= 0.4.0)
|
200
198
|
railties (>= 5.0)
|
201
|
-
websocket-driver (0.7.
|
199
|
+
websocket-driver (0.7.5)
|
202
200
|
websocket-extensions (>= 0.1.0)
|
203
|
-
websocket-extensions (0.1.
|
204
|
-
xpath (3.
|
201
|
+
websocket-extensions (0.1.5)
|
202
|
+
xpath (3.2.0)
|
205
203
|
nokogiri (~> 1.8)
|
206
204
|
|
207
205
|
PLATFORMS
|
@@ -216,7 +214,7 @@ DEPENDENCIES
|
|
216
214
|
jbuilder (~> 2.5)
|
217
215
|
listen (>= 3.0.5, < 3.2)
|
218
216
|
orthodox!
|
219
|
-
puma (~>
|
217
|
+
puma (~> 5.0)
|
220
218
|
rails (~> 5.2.0)
|
221
219
|
sass-rails (~> 5.0)
|
222
220
|
selenium-webdriver
|
@@ -229,7 +227,7 @@ DEPENDENCIES
|
|
229
227
|
web-console (>= 3.3.0)
|
230
228
|
|
231
229
|
RUBY VERSION
|
232
|
-
ruby 2.
|
230
|
+
ruby 2.7.2p137
|
233
231
|
|
234
232
|
BUNDLED WITH
|
235
|
-
1.17.
|
233
|
+
1.17.3
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
# Concern added to controllres to provide methods for authentication.
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
module Authentication
|
8
|
-
|
8
|
+
|
9
9
|
extend ActiveSupport::Concern
|
10
|
-
|
10
|
+
|
11
11
|
protected
|
12
|
-
|
12
|
+
|
13
13
|
# Sign in a given record as a given type
|
14
14
|
#
|
15
15
|
# record - An AppliationRecord subclass instance (e.g. A Member)
|
@@ -25,7 +25,7 @@ module Authentication
|
|
25
25
|
session[:"#{as}_tfa_authenticated"] = tfa
|
26
26
|
<%- end -%>
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
# Sign out a given record type.
|
30
30
|
#
|
31
31
|
# as - A String or Symbol with the model name (e.g. "member")
|
@@ -36,11 +36,11 @@ module Authentication
|
|
36
36
|
<%- end -%>
|
37
37
|
instance_variable_set("@current_#{as}", nil)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
module ClassMethods
|
41
|
-
|
41
|
+
|
42
42
|
# Create a bunch of authentication methods for a given ActiveRecord model
|
43
|
-
def authenticate_model(model_name, **options)
|
43
|
+
def authenticate_model(model_name, **options)
|
44
44
|
# Define a current_<model> method to load the currently signed in record, if present
|
45
45
|
#
|
46
46
|
# Returns ApplicationRecord subclass
|
@@ -50,24 +50,24 @@ module Authentication
|
|
50
50
|
instance_variable_get(instance_method_name)
|
51
51
|
else
|
52
52
|
scope = send(:"#{model_name}_auth_scope")
|
53
|
-
instance_variable_set(instance_method_name,
|
53
|
+
instance_variable_set(instance_method_name,
|
54
54
|
scope.find_by(id: session[:"#{model_name}_id"]))
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
# Define a controller before_action method to authenticate a record for the given
|
59
59
|
# model. Redirects to the <model_name>_failed_authentication_url if not passed.
|
60
60
|
#
|
61
61
|
# Returns nil
|
62
62
|
define_method(:"authenticate_#{model_name}") do
|
63
63
|
unless send(:"current_#{model_name}?")
|
64
|
-
redirect_to send(:"#{model_name}_failed_authentication_url"),
|
64
|
+
redirect_to send(:"#{model_name}_failed_authentication_url"),
|
65
65
|
warn: "You must be signed in to do that"
|
66
|
-
end
|
66
|
+
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
before_action :"authenticate_#{model_name}"
|
70
|
-
|
70
|
+
|
71
71
|
# Creates a scope that records are loaded through when being authenticated. Subclass
|
72
72
|
# this method to customise the load conditions.
|
73
73
|
#
|
@@ -75,37 +75,37 @@ module Authentication
|
|
75
75
|
define_method(:"#{model_name}_auth_scope") do
|
76
76
|
model_name.to_s.classify.constantize.all
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
# Creates a boolean method to check if a current_<model_name> has been authenticated
|
80
80
|
# or not.
|
81
81
|
#
|
82
82
|
# Returns Boolean
|
83
83
|
define_method(:"current_#{model_name}?") { send(:"current_#{model_name}").present? }
|
84
|
-
|
85
|
-
define_method(:"#{model_name}_signed_in?") { send(:"current_#{model_name}?") }
|
86
|
-
|
84
|
+
|
85
|
+
define_method(:"#{model_name}_signed_in?") { send(:"current_#{model_name}?") }
|
86
|
+
|
87
87
|
define_method(:"#{model_name}_failed_authentication_url") do
|
88
88
|
send(:"new_#{model_name.to_s.pluralize}_session_url")
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
helper_method :"current_#{model_name}"
|
92
92
|
helper_method :"current_#{model_name}?"
|
93
93
|
helper_method :"#{model_name}_signed_in?"
|
94
|
-
|
94
|
+
|
95
95
|
protected :"current_#{model_name}"
|
96
96
|
protected :"current_#{model_name}?"
|
97
97
|
protected :"#{model_name}_signed_in?"
|
98
98
|
protected :"authenticate_#{model_name}"
|
99
|
-
|
99
|
+
|
100
100
|
<%- if options[:two_factor] -%>
|
101
101
|
# This is included if the authentication generator is run with --two-factor=true
|
102
102
|
if options[:tfa] == true
|
103
|
-
include TwoFactorAuthentication
|
103
|
+
include TwoFactorAuthentication
|
104
104
|
define_tfa_methods(model_name)
|
105
105
|
end
|
106
106
|
<%- end -%>
|
107
107
|
end
|
108
108
|
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Controller for managing sessions for <%= plural_class_name %>.
|
4
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
|
4
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
|
+
|
6
6
|
class <%= plural_class_name %>::SessionsController < <%= plural_class_name %>::BaseController
|
7
|
-
|
7
|
+
|
8
8
|
skip_before_action :authenticate_<%= singular_name %>
|
9
9
|
|
10
10
|
def new
|
@@ -20,7 +20,7 @@ class <%= plural_class_name %>::SessionsController < <%= plural_class_name %>::B
|
|
20
20
|
render :new
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def destroy
|
25
25
|
sign_out(:<%= singular_name %>)
|
26
26
|
redirect_to root_url, notice: "Successfully signed out"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Controller for managing two-factor sessions for <%= plural_class_name %>.
|
4
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
|
4
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
|
+
|
6
6
|
class <%= plural_class_name %>::TfaSessionsController < <%= plural_class_name %>::BaseController
|
7
7
|
|
8
8
|
skip_before_action :authenticate_<%= singular_name %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Controller for managing two-factor credentials for <%= plural_class_name %>.
|
4
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
|
4
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
|
+
|
6
6
|
class <%= plural_class_name %>::TfasController < <%= plural_class_name %>::BaseController
|
7
7
|
|
8
8
|
skip_before_action :authenticate_<%= singular_name %>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
# Helper for one-time-password authentication methods
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
module OtpCredentialsHelper
|
8
8
|
|
9
9
|
require 'rqrcode'
|
@@ -1,9 +1,7 @@
|
|
1
|
-
// Basic JS functionality for one-time-password form. Designed to be used with jQuery and
|
1
|
+
// Basic JS functionality for one-time-password form. Designed to be used with jQuery and
|
2
2
|
// Bootstrap.
|
3
3
|
//
|
4
|
-
// Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
// (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
|
6
|
-
|
4
|
+
// Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
7
5
|
// Initialize method called when jQuery ready
|
8
6
|
function init() {
|
9
7
|
$("body").on("click", ".js-tfa-link", onClick);
|
@@ -16,4 +14,4 @@ function onClick(e){
|
|
16
14
|
$(".js-tfa-field-group").toggleClass("d-none");
|
17
15
|
}
|
18
16
|
|
19
|
-
jQuery(init);
|
17
|
+
jQuery(init);
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
# Model concern to provide shared behaviour for authenticating records.
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
module Authenticateable
|
8
8
|
|
9
9
|
extend ActiveSupport::Concern
|
@@ -2,8 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# Model concern to provide shared behaviour for two-factor auth (one-time password)
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
module Otpable
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# Model concern to provide shared behaviour for password resets
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
module PasswordResetable
|
8
8
|
|
9
9
|
extend ActiveSupport::Concern
|
@@ -2,8 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# Model for managing one-time password credentials for a given Member
|
4
4
|
#
|
5
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
6
|
-
|
5
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
6
|
+
|
7
7
|
#
|
8
8
|
# == Schema Information
|
9
9
|
#
|
@@ -3,8 +3,8 @@
|
|
3
3
|
#
|
4
4
|
# Model for managing password reset tokens
|
5
5
|
#
|
6
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
7
|
-
|
6
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
7
|
+
|
8
8
|
#
|
9
9
|
# == Schema Information
|
10
10
|
#
|