authentication-zero 2.16.24 → 2.16.26

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 769f7682100782d48f09608fc6468e6be06375acd2d1dabd01f0aef1074b2c96
4
- data.tar.gz: 04453fdec338106d6d2668809f2dc84b40bfb0f0635ac26204be27f6f7d0f001
3
+ metadata.gz: 31829b8815a7d6b7720997ea3cc1e85d602b43c3a2a4da30c346638617adfdb2
4
+ data.tar.gz: 1869578bdefc46e75910a53c3d6a65326255ec63ed0f7b5ceb11612e8b748b35
5
5
  SHA512:
6
- metadata.gz: 5b020228f7e344bf79771883bf498f25315078f0a8282ea617e817d658808c7706f70dc8325e1c759cf305177e9999a9f8c564666f366e25f3a9c7f85156c8c8
7
- data.tar.gz: 57ab3706f6025956a4e08d4c3c332b36685cb4f9d8dedbf5d88ccfe4ff445d4d7c572a74bea5d64071e1e9b19ddcad938357836f07c0e0a630f86cca1c5c3d0f
6
+ metadata.gz: 9134009142fed3d0f971887a21755c85369dd81f3896bb9aa6141b14a600c095ad7a16a45fd2efa69c83a10d3239450bde10300b21ac38fbfa396ae73e0cd5aa
7
+ data.tar.gz: c6647adbf7164587702ca53b4bda230c835ed53112172551c7f3f5555224f722c5f69e8511d37a5b59983a78a4d5bc778d6fbe2a556f73460b0f900893081441
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Authentication Zero 2.16.25 ##
2
+
3
+ * Add new option to refresh otp secret
4
+
1
5
  ## Authentication Zero 2.16.24 ##
2
6
 
3
7
  * Remove otp secret from client
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.16.24)
4
+ authentication-zero (2.16.26)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.16.24"
2
+ VERSION = "2.16.26"
3
3
  end
@@ -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 install_javascript_dependencies
119
- return if options.api?
120
- template "javascript/controllers/application.js", "app/javascript/controllers/application.js"
121
-
122
- if webauthn?
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
- <div>
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
- <div>
51
- <%%= button_to "Log out", Current.session, method: :delete %>
52
- </div>
48
+ <%%= button_to "Log out", Current.session, method: :delete %>
@@ -24,3 +24,9 @@
24
24
  <%%= form.submit "Send an invitation" %>
25
25
  </div>
26
26
  <%% end %>
27
+
28
+ <br>
29
+
30
+ <div>
31
+ <%%= link_to "Back", root_path %>
32
+ </div>
@@ -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>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <ul><%%= render @recovery_codes %></ul>
7
7
 
8
- <%%= link_to "OK, I'm done", root_path %>
8
+ <div><%%= link_to "OK, I'm done", root_path %></div>
9
9
 
10
10
  <hr>
11
11
 
@@ -7,4 +7,12 @@
7
7
 
8
8
  <br>
9
9
 
10
- <%%= link_to "Add security key", new_two_factor_authentication_profile_security_key_path %>
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
- <%%= link_to "Yes, use this email for my account", identity_email_verification_url(sid: @signed_id) %>
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p>You requested a magic sign-in link. Here you go:</p>
4
4
 
5
- <%%= link_to "Sign in without password", edit_sessions_passwordless_url(sid: @signed_id) %>
5
+ <p><%%= link_to "Sign in without password", edit_sessions_passwordless_url(sid: @signed_id) %></p>
6
6
 
7
7
  <hr>
8
8
 
@@ -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.24
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-13 00:00:00.000000000 Z
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.tt
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