authentication-zero 2.16.24 → 2.16.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/authentication_generator.rb +13 -16
- data/lib/generators/authentication/templates/controllers/html/two_factor_authentication/profile/totps_controller.rb.tt +6 -1
- data/lib/generators/authentication/templates/erb/home/index.html.erb.tt +2 -6
- data/lib/generators/authentication/templates/erb/invitations/new.html.erb.tt +6 -0
- data/lib/generators/authentication/templates/erb/two_factor_authentication/challenge/totps/new.html.erb.tt +1 -3
- data/lib/generators/authentication/templates/erb/two_factor_authentication/profile/recovery_codes/index.html.erb.tt +1 -1
- data/lib/generators/authentication/templates/erb/two_factor_authentication/profile/security_keys/index.html.erb.tt +9 -1
- data/lib/generators/authentication/templates/erb/two_factor_authentication/profile/totps/new.html.erb.tt +18 -0
- data/lib/generators/authentication/templates/erb/user_mailer/email_verification.html.erb.tt +1 -1
- data/lib/generators/authentication/templates/erb/user_mailer/passwordless.html.erb.tt +1 -1
- data/lib/generators/authentication/templates/javascript/controllers/{application.js.tt → application.js} +0 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31829b8815a7d6b7720997ea3cc1e85d602b43c3a2a4da30c346638617adfdb2
|
4
|
+
data.tar.gz: 1869578bdefc46e75910a53c3d6a65326255ec63ed0f7b5ceb11612e8b748b35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9134009142fed3d0f971887a21755c85369dd81f3896bb9aa6141b14a600c095ad7a16a45fd2efa69c83a10d3239450bde10300b21ac38fbfa396ae73e0cd5aa
|
7
|
+
data.tar.gz: c6647adbf7164587702ca53b4bda230c835ed53112172551c7f3f5555224f722c5f69e8511d37a5b59983a78a4d5bc778d6fbe2a556f73460b0f900893081441
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -115,14 +115,11 @@ class AuthenticationGenerator < Rails::Generators::Base
|
|
115
115
|
template "controllers/#{format_folder}/authentications/events_controller.rb", "app/controllers/authentications/events_controller.rb" if options.trackable?
|
116
116
|
end
|
117
117
|
|
118
|
-
def
|
119
|
-
return
|
120
|
-
|
121
|
-
|
122
|
-
if
|
123
|
-
run "bin/importmap pin stimulus-web-authn" if importmaps?
|
124
|
-
run "yarn add stimulus-web-authn" if node?
|
125
|
-
end
|
118
|
+
def install_javascript
|
119
|
+
return unless webauthn?
|
120
|
+
copy_file "javascript/controllers/application.js", "app/javascript/controllers/application.js", force: true
|
121
|
+
run "bin/importmap pin stimulus-web-authn" if importmaps?
|
122
|
+
run "yarn add stimulus-web-authn" if node?
|
126
123
|
end
|
127
124
|
|
128
125
|
def create_views
|
@@ -195,7 +192,7 @@ class AuthenticationGenerator < Rails::Generators::Base
|
|
195
192
|
|
196
193
|
if two_factor?
|
197
194
|
route "resources :recovery_codes, only: [:index, :create]", namespace: [:two_factor_authentication, :profile]
|
198
|
-
route "resource :totp, only: [:new, :create]", namespace: [:two_factor_authentication, :profile]
|
195
|
+
route "resource :totp, only: [:new, :create, :update]", namespace: [:two_factor_authentication, :profile]
|
199
196
|
route "resources :security_keys", namespace: [:two_factor_authentication, :profile] if webauthn?
|
200
197
|
|
201
198
|
route "resource :recovery_codes, only: [:new, :create]", namespace: [:two_factor_authentication, :challenge]
|
@@ -234,13 +231,6 @@ class AuthenticationGenerator < Rails::Generators::Base
|
|
234
231
|
options.api? ? "api" : "html"
|
235
232
|
end
|
236
233
|
|
237
|
-
def ratelimit_block
|
238
|
-
<<~CODE
|
239
|
-
# Rate limit general requests by IP address in a rate of 1000 requests per minute
|
240
|
-
config.middleware.use(Rack::Ratelimit, name: "General", rate: [1000, 1.minute], redis: Redis.new, logger: Rails.logger) { |env| ActionDispatch::Request.new(env).ip }
|
241
|
-
CODE
|
242
|
-
end
|
243
|
-
|
244
234
|
def omniauthable?
|
245
235
|
options.omniauthable? && !options.api?
|
246
236
|
end
|
@@ -280,4 +270,11 @@ class AuthenticationGenerator < Rails::Generators::Base
|
|
280
270
|
def node?
|
281
271
|
Rails.root.join("package.json").exist?
|
282
272
|
end
|
273
|
+
|
274
|
+
def ratelimit_block
|
275
|
+
<<~CODE
|
276
|
+
# Rate limit general requests by IP address in a rate of 1000 requests per minute
|
277
|
+
config.middleware.use(Rack::Ratelimit, name: "General", rate: [1000, 1.minute], redis: Redis.new, logger: Rails.logger) { |env| ActionDispatch::Request.new(env).ip }
|
278
|
+
CODE
|
279
|
+
end
|
283
280
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class TwoFactorAuthentication::Profile::TotpsController < ApplicationController
|
2
2
|
before_action :set_user
|
3
|
-
before_action :set_totp
|
3
|
+
before_action :set_totp, only: %i[ new create ]
|
4
4
|
|
5
5
|
def new
|
6
6
|
@qr_code = RQRCode::QRCode.new(provisioning_uri)
|
@@ -15,6 +15,11 @@ class TwoFactorAuthentication::Profile::TotpsController < ApplicationController
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def update
|
19
|
+
@user.update! otp_secret: ROTP::Base32.random
|
20
|
+
redirect_to new_two_factor_authentication_profile_totp_path
|
21
|
+
end
|
22
|
+
|
18
23
|
private
|
19
24
|
def set_user
|
20
25
|
@user = Current.user
|
@@ -29,9 +29,7 @@
|
|
29
29
|
</div>
|
30
30
|
<%- end -%>
|
31
31
|
<%- if masqueradable? %>
|
32
|
-
|
33
|
-
<%%= button_to "Signin as last user", user_masquerade_path(User.last) %>
|
34
|
-
</div>
|
32
|
+
<%%= button_to "Signin as last user", user_masquerade_path(User.last) %>
|
35
33
|
<%- end -%>
|
36
34
|
|
37
35
|
<h2>Access history</h2>
|
@@ -47,6 +45,4 @@
|
|
47
45
|
|
48
46
|
<br>
|
49
47
|
|
50
|
-
|
51
|
-
<%%= button_to "Log out", Current.session, method: :delete %>
|
52
|
-
</div>
|
48
|
+
<%%= button_to "Log out", Current.session, method: :delete %>
|
@@ -15,9 +15,7 @@
|
|
15
15
|
|
16
16
|
<div>
|
17
17
|
<p><strong>Don't have your phone?</strong></p>
|
18
|
-
<div>
|
19
|
-
<%%= link_to "Use a recovery code to access your account.", new_two_factor_authentication_challenge_recovery_codes_path %>
|
20
|
-
</div>
|
18
|
+
<div><%%= link_to "Use a recovery code to access your account.", new_two_factor_authentication_challenge_recovery_codes_path %></div>
|
21
19
|
<%- if webauthn? %>
|
22
20
|
<%% if @user.security_keys.exists? %>
|
23
21
|
<div><%%= link_to "Use a security key to access your account.", new_two_factor_authentication_challenge_security_keys_path %></div>
|
@@ -7,4 +7,12 @@
|
|
7
7
|
|
8
8
|
<br>
|
9
9
|
|
10
|
-
|
10
|
+
<div>
|
11
|
+
<%%= link_to "Add security key", new_two_factor_authentication_profile_security_key_path %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<br>
|
15
|
+
|
16
|
+
<div>
|
17
|
+
<%%= link_to "Back", root_path %>
|
18
|
+
</div>
|
@@ -1,5 +1,17 @@
|
|
1
1
|
<p style="color: red"><%%= alert %></p>
|
2
2
|
|
3
|
+
<%% if Current.user.otp_required_for_sign_in? %>
|
4
|
+
<h1>Want to replace your existing 2FA setup?</h1>
|
5
|
+
|
6
|
+
<p>Your account is already protected with two-factor authentication. You can replace that setup if you want to switch to a new phone or authenticator app.</p>
|
7
|
+
|
8
|
+
<p><strong>Do you want to continue? Your existing 2FA setup will no longer work.</strong></p>
|
9
|
+
|
10
|
+
<%%= button_to "Yes, replace my 2FA setup", two_factor_authentication_profile_totp_path, method: :patch %>
|
11
|
+
|
12
|
+
<hr>
|
13
|
+
<%% end %>
|
14
|
+
|
3
15
|
<h1>Upgrade your security with 2FA</h1>
|
4
16
|
|
5
17
|
<h2>Step 1: Get an Authenticator App</h2>
|
@@ -24,3 +36,9 @@
|
|
24
36
|
<%%= form.submit "Verify and activate" %>
|
25
37
|
</div>
|
26
38
|
<%% end %>
|
39
|
+
|
40
|
+
<br>
|
41
|
+
|
42
|
+
<div>
|
43
|
+
<%%= link_to "Back", root_path %>
|
44
|
+
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<p><strong>You must hit the link below to confirm that you received this email.</strong></p>
|
6
6
|
|
7
|
-
|
7
|
+
<p><%%= link_to "Yes, use this email for my account", identity_email_verification_url(sid: @signed_id) %></p>
|
8
8
|
|
9
9
|
<hr>
|
10
10
|
|
@@ -1,12 +1,8 @@
|
|
1
1
|
import { Application } from "@hotwired/stimulus"
|
2
|
-
<%- if webauthn? -%>
|
3
2
|
import WebAuthnController from "stimulus-web-authn"
|
4
|
-
<%- end -%>
|
5
3
|
|
6
4
|
const application = Application.start()
|
7
|
-
<%- if webauthn? -%>
|
8
5
|
application.register("web-authn", WebAuthnController)
|
9
|
-
<%- end -%>
|
10
6
|
|
11
7
|
// Configure Stimulus development experience
|
12
8
|
application.debug = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authentication-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.16.
|
4
|
+
version: 2.16.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- lib/generators/authentication/templates/erb/user_mailer/invitation_instructions.html.erb.tt
|
95
95
|
- lib/generators/authentication/templates/erb/user_mailer/password_reset.html.erb.tt
|
96
96
|
- lib/generators/authentication/templates/erb/user_mailer/passwordless.html.erb.tt
|
97
|
-
- lib/generators/authentication/templates/javascript/controllers/application.js
|
97
|
+
- lib/generators/authentication/templates/javascript/controllers/application.js
|
98
98
|
- lib/generators/authentication/templates/mailers/user_mailer.rb.tt
|
99
99
|
- lib/generators/authentication/templates/migrations/create_email_verification_tokens_migration.rb.tt
|
100
100
|
- lib/generators/authentication/templates/migrations/create_events_migration.rb.tt
|