rodauth-rails 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09013a1bf694e549fa97b25df4490342da804f04a4b390e3c443130b2ae6d39c'
4
- data.tar.gz: 9c8a721619b16280d7892fe35ec6d0368d3bef2dd9eb0a26edddd5f65f87f5cb
3
+ metadata.gz: 8a0e7a34f68cd9914ad148799dcc5b83c5f8509d6d3278f57a26ebd497a8460c
4
+ data.tar.gz: bfacb6b1ee374c5c0c1178d1a3b22a08bdb78626c1c91f3997a3c8572a8ede85
5
5
  SHA512:
6
- metadata.gz: 3710f7d71bff102f6a4564542575a75798df2063df3217a01574b04a541def22fb1ca04cf529fdfb1709e5f6c334f3ddda7027dce639f7b1d47ba4f71ba421df
7
- data.tar.gz: b36c22fdd2e297058ac576d5c064ccb3a982370c0d0d70d2651a1b271ec2e0be4af7a8844dec098bfb839de90d5f3149d88987ed58c1728a4a7ecb039e874a4e
6
+ metadata.gz: eb5ff0efa4e19d89f864eea1e5d2e7541b2a198cff6af02ec281904e660bac5124d59842f602527e988ac958913724c54225fceb02ca834f1ee03cbf6a975f24
7
+ data.tar.gz: 13350871f426602595dfa738b1a2016372f589788dfdd5d06ad5e915d351d2d5a4f3cec18c45871337153106c1f524ab27bae7f4c7f30c7e9fb2dbe02025c77d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 1.7.1 (2023-01-25)
2
+
3
+ * Make internal_request integration work on Rack 3.x (@janko)
4
+
5
+ * Add missing Tailwind templates for WebAuthn feature (@janko)
6
+
7
+ * Use renamed `webauthn_credential_options_for_get` method in generated `webauthn_auth` template (@janko)
8
+
9
+ * Fix generated `webauthn_setup` template not working with webauthn_verify_account feature (@janko)
10
+
11
+ * Hide text fields in generated `webauthn_{setup,auth}` templates (@janko)
12
+
13
+ * Fix loading JavaScript for WebAuthn in generated `webauthn_{setup,auth}` templates (@janko)
14
+
15
+ * Make built-in mailer work in Rails 6.x on Ruby 3.2 (@janko)
16
+
1
17
  ## 1.7.0 (2022-12-21)
2
18
 
3
19
  * Add Tailwind CSS templates to `rodauth:views` generator via the `--css=tailwind` option (@benkoshy, @janko)
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020-2022 Janko Marohnić
3
+ Copyright (c) 2020-2023 Janko Marohnić
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,13 @@
1
+ <% cred = rodauth.webauthn_credential_options_for_get %>
2
+
3
+ <%= form_with url: rodauth.webauthn_auth_form_path, method: :post, id: "webauthn-auth-form", data: { credential_options: cred.as_json.to_json, turbo: false }, class: "w-full max-w-sm" do |form| %>
4
+ <%= form.hidden_field rodauth.login_param, value: params[rodauth.login_param] %>
5
+ <%= form.hidden_field rodauth.webauthn_auth_challenge_param, value: cred.challenge %>
6
+ <%= form.hidden_field rodauth.webauthn_auth_challenge_hmac_param, value: rodauth.compute_hmac(cred.challenge) %>
7
+ <%= form.text_field rodauth.webauthn_auth_param, value: "", id: "webauthn-auth", class: "hidden", aria: { hidden: "true" } %>
8
+ <div id="webauthn-auth-button">
9
+ <%= form.submit rodauth.webauthn_auth_button, class: "w-full px-8 py-3 cursor-pointer font-semibold text-sm rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-600 dark:bg-emerald-400 dark:hover:bg-emerald-500 dark:text-gray-900 dark:focus:ring-emerald-400 dark:focus:ring-offset-current" %>
10
+ </div>
11
+ <% end %>
12
+
13
+ <%= javascript_include_tag rodauth.webauthn_auth_js_path, extname: false %>
@@ -0,0 +1,21 @@
1
+ <%= form_with url: rodauth.webauthn_remove_path, method: :post, id: "webauthn-remove-form", data: { turbo: false }, class: "w-full max-w-sm" do |form| %>
2
+ <% if rodauth.two_factor_modifications_require_password? %>
3
+ <div class="mb-6">
4
+ <%= form.label "password", rodauth.password_label, class: "block text-sm font-semibold" %>
5
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "mt-2 text-sm w-full px-3 py-2 border rounded-md dark:bg-gray-900 dark:text-gray-100 dark:focus:bg-gray-800 #{rodauth.field_error(rodauth.password_param) ? "border-red-600 focus:ring-red-600 focus:border-red-600 dark:border-red-400 dark:focus:ring-red-400" : "border-gray-300 dark:border-gray-700 dark:focus:border-emerald-400 dark:focus:ring-emerald-400" }", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
6
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "block mt-1 text-red-600 text-xs dark:text-red-400", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
7
+ </div>
8
+ <% end %>
9
+
10
+ <fieldset class="mb-6">
11
+ <% (usage = rodauth.account_webauthn_usage).each do |id, last_use| %>
12
+ <div class="flex items-center space-x-2">
13
+ <%= form.radio_button rodauth.webauthn_remove_param, id, id: "webauthn-remove-#{id}", class: "dark:bg-gray-900 dark:border-gray-600 dark:checked:bg-current dark:checked:border-current dark:checked:text-emerald-400 dark:focus:ring-emerald-400 dark:focus:ring-offset-gray-900" %>
14
+ <%= form.label "webauthn-remove-#{id}", "Last use: #{last_use}", class: "text-sm" %>
15
+ <%= content_tag(:span, rodauth.field_error(rodauth.webauthn_remove_param), class: "block mt-1 text-red-600 text-xs dark:text-red-400", id: "webauthn_remove_error_message") if rodauth.field_error(rodauth.webauthn_remove_param) && id == usage.keys.last %>
16
+ </div>
17
+ <% end %>
18
+ </fieldset>
19
+
20
+ <%= form.submit rodauth.webauthn_remove_button, class: "w-full px-8 py-3 cursor-pointer font-semibold text-sm rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-600 dark:bg-emerald-400 dark:hover:bg-emerald-500 dark:text-gray-900 dark:focus:ring-emerald-400 dark:focus:ring-offset-current" %>
21
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <% cred = rodauth.new_webauthn_credential %>
2
+
3
+ <%= form_with url: request.path, method: :post, id: "webauthn-setup-form", data: { credential_options: cred.as_json.to_json, turbo: false }, class: "w-full max-w-sm" do |form| %>
4
+ <%= form.hidden_field rodauth.webauthn_setup_challenge_param, value: cred.challenge %>
5
+ <%= form.hidden_field rodauth.webauthn_setup_challenge_hmac_param, value: rodauth.compute_hmac(cred.challenge) %>
6
+ <%= form.text_field rodauth.webauthn_setup_param, value: "", id: "webauthn-setup", class: "hidden", aria: { hidden: "true" } %>
7
+
8
+ <% if rodauth.two_factor_modifications_require_password? %>
9
+ <div class="mb-6">
10
+ <%= form.label "password", rodauth.password_label, class: "block text-sm font-semibold" %>
11
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "mt-2 text-sm w-full px-3 py-2 border rounded-md dark:bg-gray-900 dark:text-gray-100 dark:focus:bg-gray-800 #{rodauth.field_error(rodauth.password_param) ? "border-red-600 focus:ring-red-600 focus:border-red-600 dark:border-red-400 dark:focus:ring-red-400" : "border-gray-300 dark:border-gray-700 dark:focus:border-emerald-400 dark:focus:ring-emerald-400" }", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
12
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "block mt-1 text-red-600 text-xs dark:text-red-400", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <div id="webauthn-setup-button">
17
+ <%= form.submit rodauth.webauthn_setup_button, class: "w-full px-8 py-3 cursor-pointer font-semibold text-sm rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-600 dark:bg-emerald-400 dark:hover:bg-emerald-500 dark:text-gray-900 dark:focus:ring-emerald-400 dark:focus:ring-offset-current" %>
18
+ </div>
19
+ <% end %>
20
+
21
+ <%= javascript_include_tag rodauth.webauthn_setup_js_path, extname: false %>
@@ -1,10 +1,10 @@
1
- <% cred = rodauth.webauth_credential_options_for_get %>
1
+ <% cred = rodauth.webauthn_credential_options_for_get %>
2
2
 
3
3
  <%= form_with url: rodauth.webauthn_auth_form_path, method: :post, id: "webauthn-auth-form", data: { credential_options: cred.as_json.to_json, turbo: false } do |form| %>
4
4
  <%= form.hidden_field rodauth.login_param, value: params[rodauth.login_param] %>
5
5
  <%= form.hidden_field rodauth.webauthn_auth_challenge_param, value: cred.challenge %>
6
6
  <%= form.hidden_field rodauth.webauthn_auth_challenge_hmac_param, value: rodauth.compute_hmac(cred.challenge) %>
7
- <%= form.text_field rodauth.webauthn_auth_param, value: "", id: "webauthn-auth", aria: { hidden: "true" } %>
7
+ <%= form.text_field rodauth.webauthn_auth_param, value: "", id: "webauthn-auth", class: "d-none", aria: { hidden: "true" } %>
8
8
  <div id="webauthn-auth-button">
9
9
  <div class="form-group mb-3">
10
10
  <%= form.submit rodauth.webauthn_auth_button, class: "btn btn-primary" %>
@@ -12,4 +12,4 @@
12
12
  </div>
13
13
  <% end %>
14
14
 
15
- <%= javascript_include_tag rodauth.webauthn_auth_js_path %>
15
+ <%= javascript_include_tag rodauth.webauthn_auth_js_path, extname: false %>
@@ -1,9 +1,9 @@
1
1
  <% cred = rodauth.new_webauthn_credential %>
2
2
 
3
- <%= form_with url: rodauth.webauthn_setup_path, method: :post, id: "webauthn-setup-form", data: { credential_options: cred.as_json.to_json, turbo: false } do |form| %>
3
+ <%= form_with url: request.path, method: :post, id: "webauthn-setup-form", data: { credential_options: cred.as_json.to_json, turbo: false } do |form| %>
4
4
  <%= form.hidden_field rodauth.webauthn_setup_challenge_param, value: cred.challenge %>
5
5
  <%= form.hidden_field rodauth.webauthn_setup_challenge_hmac_param, value: rodauth.compute_hmac(cred.challenge) %>
6
- <%= form.text_field rodauth.webauthn_setup_param, value: "", id: "webauthn-setup", aria: { hidden: "true" } %>
6
+ <%= form.text_field rodauth.webauthn_setup_param, value: "", id: "webauthn-setup", class: "d-none", aria: { hidden: "true" } %>
7
7
 
8
8
  <% if rodauth.two_factor_modifications_require_password? %>
9
9
  <div class="form-group mb-3">
@@ -13,11 +13,11 @@
13
13
  </div>
14
14
  <% end %>
15
15
 
16
- <div id="webauthn-setup-button">
16
+ <div id="webauthn-setup-button">
17
17
  <div class="form-group mb-3">
18
18
  <%= form.submit rodauth.webauthn_setup_button, class: "btn btn-primary" %>
19
19
  </div>
20
20
  </div>
21
21
  <% end %>
22
22
 
23
- <%= javascript_include_tag rodauth.webauthn_setup_js_path %>
23
+ <%= javascript_include_tag rodauth.webauthn_setup_js_path, extname: false %>
@@ -22,8 +22,8 @@ module Rodauth
22
22
 
23
23
  # ActionMailer subclass for correct email delivering.
24
24
  class Mailer < ActionMailer::Base
25
- def create_email(**options)
26
- mail(**options)
25
+ def create_email(options)
26
+ mail(options)
27
27
  end
28
28
  end
29
29
  end
@@ -41,7 +41,7 @@ module Rodauth
41
41
  # Checks whether we're in an internal request and host was not set,
42
42
  # or the request doesn't exist such as with path_class_methods feature.
43
43
  def missing_host?
44
- internal_request? && request.host == INVALID_DOMAIN || scope.nil?
44
+ internal_request? && (request.host.nil? || request.host == INVALID_DOMAIN) || scope.nil?
45
45
  end
46
46
 
47
47
  def rails_url_options
@@ -1,5 +1,5 @@
1
1
  module Rodauth
2
2
  module Rails
3
- VERSION = "1.7.0"
3
+ VERSION = "1.7.1"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency "railties", ">= 4.2", "< 8"
20
- spec.add_dependency "rodauth", "~> 2.25"
20
+ spec.add_dependency "rodauth", "~> 2.27"
21
21
  spec.add_dependency "roda", "~> 3.55"
22
22
  spec.add_dependency "sequel-activerecord_connection", "~> 1.1"
23
23
  spec.add_dependency "rodauth-model", "~> 0.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.25'
39
+ version: '2.27'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.25'
46
+ version: '2.27'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: roda
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -286,6 +286,9 @@ files:
286
286
  - lib/generators/rodauth/templates/app/views/rodauth/tailwind/verify_account.html.erb
287
287
  - lib/generators/rodauth/templates/app/views/rodauth/tailwind/verify_account_resend.html.erb
288
288
  - lib/generators/rodauth/templates/app/views/rodauth/tailwind/verify_login_change.html.erb
289
+ - lib/generators/rodauth/templates/app/views/rodauth/tailwind/webauthn_auth.html.erb
290
+ - lib/generators/rodauth/templates/app/views/rodauth/tailwind/webauthn_remove.html.erb
291
+ - lib/generators/rodauth/templates/app/views/rodauth/tailwind/webauthn_setup.html.erb
289
292
  - lib/generators/rodauth/templates/app/views/rodauth/two_factor_auth.html.erb
290
293
  - lib/generators/rodauth/templates/app/views/rodauth/two_factor_disable.html.erb
291
294
  - lib/generators/rodauth/templates/app/views/rodauth/two_factor_manage.html.erb
@@ -349,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
352
  - !ruby/object:Gem::Version
350
353
  version: '0'
351
354
  requirements: []
352
- rubygems_version: 3.3.3
355
+ rubygems_version: 3.4.4
353
356
  signing_key:
354
357
  specification_version: 4
355
358
  summary: Provides Rails integration for Rodauth.