rodauth-rails 0.17.1 → 0.18.0

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +27 -17
  4. data/lib/generators/rodauth/install_generator.rb +1 -1
  5. data/lib/generators/rodauth/templates/app/views/rodauth/_email_auth_request_form.html.erb +7 -4
  6. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form.html.erb +26 -9
  7. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_footer.html.erb +7 -6
  8. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_header.html.erb +3 -3
  9. data/lib/generators/rodauth/templates/app/views/rodauth/add_recovery_codes.html.erb +7 -5
  10. data/lib/generators/rodauth/templates/app/views/rodauth/change_login.html.erb +29 -6
  11. data/lib/generators/rodauth/templates/app/views/rodauth/change_password.html.erb +29 -6
  12. data/lib/generators/rodauth/templates/app/views/rodauth/close_account.html.erb +15 -4
  13. data/lib/generators/rodauth/templates/app/views/rodauth/confirm_password.html.erb +13 -4
  14. data/lib/generators/rodauth/templates/app/views/rodauth/create_account.html.erb +37 -7
  15. data/lib/generators/rodauth/templates/app/views/rodauth/email_auth.html.erb +7 -3
  16. data/lib/generators/rodauth/templates/app/views/rodauth/login.html.erb +5 -3
  17. data/lib/generators/rodauth/templates/app/views/rodauth/logout.html.erb +16 -4
  18. data/lib/generators/rodauth/templates/app/views/rodauth/multi_phase_login.html.erb +5 -3
  19. data/lib/generators/rodauth/templates/app/views/rodauth/otp_auth.html.erb +17 -4
  20. data/lib/generators/rodauth/templates/app/views/rodauth/otp_disable.html.erb +15 -4
  21. data/lib/generators/rodauth/templates/app/views/rodauth/otp_setup.html.erb +30 -10
  22. data/lib/generators/rodauth/templates/app/views/rodauth/recovery_auth.html.erb +13 -4
  23. data/lib/generators/rodauth/templates/app/views/rodauth/recovery_codes.html.erb +15 -1
  24. data/lib/generators/rodauth/templates/app/views/rodauth/remember.html.erb +14 -9
  25. data/lib/generators/rodauth/templates/app/views/rodauth/reset_password.html.erb +21 -5
  26. data/lib/generators/rodauth/templates/app/views/rodauth/reset_password_request.html.erb +19 -9
  27. data/lib/generators/rodauth/templates/app/views/rodauth/sms_auth.html.erb +17 -4
  28. data/lib/generators/rodauth/templates/app/views/rodauth/sms_confirm.html.erb +17 -4
  29. data/lib/generators/rodauth/templates/app/views/rodauth/sms_disable.html.erb +15 -4
  30. data/lib/generators/rodauth/templates/app/views/rodauth/sms_request.html.erb +7 -3
  31. data/lib/generators/rodauth/templates/app/views/rodauth/sms_setup.html.erb +25 -5
  32. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_auth.html.erb +5 -3
  33. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_disable.html.erb +15 -4
  34. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_manage.html.erb +17 -15
  35. data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account.html.erb +17 -5
  36. data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account_request.html.erb +11 -5
  37. data/lib/generators/rodauth/templates/app/views/rodauth/verify_account.html.erb +23 -5
  38. data/lib/generators/rodauth/templates/app/views/rodauth/verify_account_resend.html.erb +19 -9
  39. data/lib/generators/rodauth/templates/app/views/rodauth/verify_login_change.html.erb +7 -3
  40. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_auth.html.erb +13 -9
  41. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_remove.html.erb +21 -9
  42. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_setup.html.erb +21 -9
  43. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/email_auth.text.erb +1 -1
  44. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/reset_password.text.erb +1 -1
  45. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/unlock_account.text.erb +1 -1
  46. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/verify_account.text.erb +1 -1
  47. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/verify_login_change.text.erb +3 -3
  48. data/lib/generators/rodauth/views_generator.rb +55 -93
  49. data/lib/rodauth/rails/app.rb +4 -0
  50. data/lib/rodauth/rails/feature/render.rb +1 -1
  51. data/lib/rodauth/rails/railtie.rb +4 -2
  52. data/lib/rodauth/rails/version.rb +1 -1
  53. data/lib/rodauth/rails.rb +8 -7
  54. metadata +2 -18
  55. data/lib/generators/rodauth/templates/app/views/rodauth/_field.html.erb +0 -10
  56. data/lib/generators/rodauth/templates/app/views/rodauth/_field_error.html.erb +0 -3
  57. data/lib/generators/rodauth/templates/app/views/rodauth/_global_logout_field.html.erb +0 -6
  58. data/lib/generators/rodauth/templates/app/views/rodauth/_login_confirm_field.html.erb +0 -4
  59. data/lib/generators/rodauth/templates/app/views/rodauth/_login_display.html.erb +0 -4
  60. data/lib/generators/rodauth/templates/app/views/rodauth/_login_field.html.erb +0 -4
  61. data/lib/generators/rodauth/templates/app/views/rodauth/_login_hidden_field.html.erb +0 -1
  62. data/lib/generators/rodauth/templates/app/views/rodauth/_new_password_field.html.erb +0 -4
  63. data/lib/generators/rodauth/templates/app/views/rodauth/_otp_auth_code_field.html.erb +0 -8
  64. data/lib/generators/rodauth/templates/app/views/rodauth/_password_confirm_field.html.erb +0 -4
  65. data/lib/generators/rodauth/templates/app/views/rodauth/_password_field.html.erb +0 -4
  66. data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_code_field.html.erb +0 -4
  67. data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_codes_form.html.erb +0 -6
  68. data/lib/generators/rodauth/templates/app/views/rodauth/_sms_code_field.html.erb +0 -8
  69. data/lib/generators/rodauth/templates/app/views/rodauth/_sms_phone_field.html.erb +0 -8
  70. data/lib/generators/rodauth/templates/app/views/rodauth/_submit.html.erb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 458a4a5552c124a1e7587837bbd57eed020857ae691bcc4b1f2e2639df774bb8
4
- data.tar.gz: b19da17830585641950d026dff75ebd32ded19ad16dd5fb5c3b8a33c34b0a8f6
3
+ metadata.gz: de49a82bc699c6aff9764e277e9d03171d5808b907e53f4668c195c744ac05fc
4
+ data.tar.gz: 8f921485a7ebb8fdbdc810eb8900480aae8b11ba9c3cdc3540e82a581951e270
5
5
  SHA512:
6
- metadata.gz: 01d5c774269d260e2805e0a2e4a509d9db81a3a966e94176cd6c5df6d808356feee48c5009b9692e0647034ae1c4d6ea3dc29627fa2000d05821a4402080601a
7
- data.tar.gz: 1dde8d0ffb4605d3abf7893628a804eca7c0fbc94f2418176651dce81fac14eb4dfe1d165e315288a2a46373b818c795e15e9d58b5ad77f15b1fb5c3d9efc4be
6
+ metadata.gz: e8ef59ddc0de0a5f0a9197597195701f0f37f9fffba4112309603279af151f7d9c6d9b50453f8217b3c93db2228b095d369f0c399716f4114dbafb8244f94718
7
+ data.tar.gz: d1ac36ce1fc3c647e740c18a90fde1302d3ba3476a89bf55e78be6d4e7998dced276504c11f721fa14016688ec3d14fb2e7556c327f1fdf0571a9dbade82d6a4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## 0.18.0 (2021-11-05)
2
+
3
+ * Disable Turbo on the generated login form (@janko)
4
+
5
+ * Generate controller views with `form_with` helper on Rails 5.1+ (@janko)
6
+
7
+ * Fix missing layout error when rendering Rodauth's built-in templates when using Turbo on Rails 6.0+ (@janko)
8
+
9
+ * Fix `Rodauth::Rails.middleware` config not actually affecting middleware insertion (@janko)
10
+
11
+ * Set page titles in generated view templates (@janko)
12
+
13
+ * Merge field and button partials into view templates (@janko)
14
+
15
+ * Raise error for unknown configuration in `Rodauth::Rails.model` (@janko)
16
+
17
+ * Generate views for all enabled features by default in `rodauth:views` generator (@janko)
18
+
19
+ * Add `Rodauth::Rails::App.rodauth!` which raises an error for unknown configuration (@janko)
20
+
21
+ * Remove deprecated `--features` option from `rodauth:views` generator (@janko)
22
+
23
+ * Inline `_recovery_codes_form.html.erb` partial into `recovery_codes.html.erb` (@janko)
24
+
25
+ * Use Rodauth helper methods for texts in generated views, for easier i18n (@janko)
26
+
27
+ * Allow setting passing a `Sequel::Model` to `:account` in `Rodauth::Rails.rodauth` (@janko)
28
+
1
29
  ## 0.17.1 (2021-10-20)
2
30
 
3
31
  * Skip checking CSRF when request forgery protection wasn't loaded on the controller (@janko)
data/README.md CHANGED
@@ -49,7 +49,7 @@ For instructions on upgrading from previous rodauth-rails versions, see
49
49
  Add the gem to your Gemfile:
50
50
 
51
51
  ```rb
52
- gem "rodauth-rails", "~> 0.17"
52
+ gem "rodauth-rails", "~> 0.18"
53
53
 
54
54
  # gem "jwt", require: false # for JWT feature
55
55
  # gem "rotp", require: false # for OTP feature
@@ -282,12 +282,12 @@ copy Rodauth templates into your Rails app:
282
282
  $ rails generate rodauth:views
283
283
  ```
284
284
 
285
- This will generate views for the default set of Rodauth features into the
286
- `app/views/rodauth` directory, provided that `RodauthController` is set for the
287
- main configuration.
285
+ This will generate views for Rodauth features you have currently enabled into
286
+ the `app/views/rodauth` directory, provided that `RodauthController` is set for
287
+ the main configuration.
288
288
 
289
289
  You can pass a list of Rodauth features to the generator to create views for
290
- these features (this will not remove or overwrite any existing views):
290
+ these features (this will not remove any existing views):
291
291
 
292
292
  ```sh
293
293
  $ rails generate rodauth:views login create_account lockout otp
@@ -302,7 +302,7 @@ $ rails generate rodauth:views --all
302
302
  Use `--name` to generate views for a different Rodauth configuration:
303
303
 
304
304
  ```sh
305
- $ rails generate rodauth:views --name admin
305
+ $ rails generate rodauth:views webauthn --name admin
306
306
  ```
307
307
 
308
308
  #### Layout
@@ -1034,7 +1034,24 @@ end
1034
1034
  While Rodauth doesn't yet come with [OmniAuth] integration, we can build one
1035
1035
  ourselves using the existing Rodauth API.
1036
1036
 
1037
- In order to allow the user to login via multiple external providers, let's
1037
+ Let's assume we're building Facebook login. We'll start by installing the
1038
+ necessary gems, and loading the Facebook OmniAuth strategy:
1039
+
1040
+ ```rb
1041
+ # Gemfile
1042
+ gem "omniauth", "~> 2.0"
1043
+ gem "omniauth-rails_csrf_protection" # https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
1044
+ gem "omniauth-facebook"
1045
+ ```
1046
+ ```rb
1047
+ # config/initializers/omniauth.rb
1048
+ Rails.application.config.middleware.use OmniAuth::Builder do
1049
+ provider :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"],
1050
+ scope: "email", callback_path: "/auth/facebook/callback"
1051
+ end
1052
+ ```
1053
+
1054
+ Since users might potentially want to login with multiple external providers, let's
1038
1055
  create an `account_identities` table that will have a many-to-one relationship
1039
1056
  with the `accounts` table:
1040
1057
 
@@ -1071,18 +1088,11 @@ class Account < ApplicationRecord
1071
1088
  end
1072
1089
  ```
1073
1090
 
1074
- Let's assume we want to implement Facebook login, and have added the
1075
- corresponding OmniAuth strategy to the middleware stack, together with an
1076
- authorization link on the login form:
1091
+ Next, let's add a POST button pointing to the request URL to our login form:
1077
1092
 
1078
- ```rb
1079
- Rails.application.config.middleware.use OmniAuth::Builder do
1080
- provider :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"],
1081
- scope: "email", callback_path: "/auth/facebook/callback"
1082
- end
1083
- ```
1084
1093
  ```erb
1085
- <%= link_to "Login via Facebook", "/auth/facebook" %>
1094
+ <%= button_to "Login via Facebook", "/auth/facebook",
1095
+ method: :post, data: { turbo: false }, class: "btn btn-link p-0" %>
1086
1096
  ```
1087
1097
 
1088
1098
  Finally, let's implement the OmniAuth callback endpoint on our Rodauth
@@ -60,7 +60,7 @@ module Rodauth
60
60
  template "app/mailers/rodauth_mailer.rb"
61
61
 
62
62
  MAILER_VIEWS.each do |view|
63
- template "app/views/rodauth_mailer/#{view}.text.erb"
63
+ copy_file "app/views/rodauth_mailer/#{view}.text.erb"
64
64
  end
65
65
  end
66
66
 
@@ -1,4 +1,7 @@
1
- <%%= form_tag <%= rodauth %>.email_auth_request_path, method: :post do %>
2
- <%%= render "login_hidden_field" %>
3
- <%%= render "submit", value: "Send Login Link Via Email" %>
4
- <%% end %>
1
+ <%= form_with url: rodauth.email_auth_request_path, method: :post do |form| %>
2
+ <%= form.hidden_field rodauth.login_param, value: params[rodauth.login_param] %>
3
+
4
+ <div class="form-group mb-3">
5
+ <%= form.submit rodauth.email_auth_request_button, class: "btn btn-primary" %>
6
+ </div>
7
+ <% end %>
@@ -1,9 +1,26 @@
1
- <%%= form_tag <%= rodauth %>.login_path, method: :post do %>
2
- <%% if <%= rodauth %>.skip_login_field_on_login? %>
3
- <%%= render "login_display" %>
4
- <%% else %>
5
- <%%= render "login_field" %>
6
- <%% end %>
7
- <%%= render "password_field" unless <%= rodauth %>.skip_password_field_on_login? %>
8
- <%%= render "submit", value: "Login" %>
9
- <%% end %>
1
+ <%= form_with url: rodauth.login_path, method: :post, data: { turbo: false } do |form| %>
2
+ <% if rodauth.skip_login_field_on_login? %>
3
+ <div class="form-group mb-3">
4
+ <%= form.label "login", rodauth.login_label, class: "form-label" %>
5
+ <%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", readonly: true, class: "form-control-plaintext" %>
6
+ </div>
7
+ <% else %>
8
+ <div class="form-group mb-3">
9
+ <%= form.label "login", rodauth.login_label, class: "form-label" %>
10
+ <%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
11
+ <%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
12
+ </div>
13
+ <% end %>
14
+
15
+ <% unless rodauth.skip_password_field_on_login? %>
16
+ <div class="form-group mb-3">
17
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
18
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
19
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
20
+ </div>
21
+ <% end %>
22
+
23
+ <div class="form-group mb-3">
24
+ <%= form.submit rodauth.login_button, class: "btn btn-primary" %>
25
+ </div>
26
+ <% end %>
@@ -1,8 +1,9 @@
1
- <%% unless <%= rodauth %>.login_form_footer_links.empty? %>
2
- <h2>Other Options</h2>
1
+ <% unless rodauth.login_form_footer_links.empty? %>
2
+ <%== rodauth.login_form_footer_links_heading %>
3
+
3
4
  <ul>
4
- <%% <%= rodauth %>.login_form_footer_links.sort.each do |_, link, text| %>
5
- <li><%%= link_to text, link %></li>
6
- <%% end %>
5
+ <% rodauth.login_form_footer_links.sort.each do |_, link, text| %>
6
+ <li><%= link_to text, link %></li>
7
+ <% end %>
7
8
  </ul>
8
- <%% end %>
9
+ <% end %>
@@ -1,3 +1,3 @@
1
- <%% if <%= rodauth %>.field_error("password") && <%= rodauth %>.features.include?(:reset_password) %>
2
- <%%= render template: "<%= directory %>/reset_password_request", layout: false %>
3
- <%% end %>
1
+ <% if rodauth.field_error(rodauth.password_param) && rodauth.features.include?(:reset_password) %>
2
+ <%= render template: "rodauth/reset_password_request", layout: false %>
3
+ <% end %>
@@ -1,6 +1,8 @@
1
- <pre id="recovery-codes"><%%= <%= rodauth %>.recovery_codes.map { |s| h(s) }.join("\n\n") %></pre>
1
+ <% content_for :title, rodauth.add_recovery_codes_page_title %>
2
2
 
3
- <%% if <%= rodauth %>.can_add_recovery_codes? %>
4
- <h2>Add Additional Recovery Codes</h2>
5
- <%%= render "recovery_codes_form" %>
6
- <%% end %>
3
+ <pre id="recovery-codes"><%= rodauth.recovery_codes.map { |s| h(s) }.join("\n\n") %></pre>
4
+
5
+ <% if rodauth.can_add_recovery_codes? %>
6
+ <%== rodauth.add_recovery_codes_heading %>
7
+ <%= render template: "rodauth/recovery_codes", layout: false %>
8
+ <% end %>
@@ -1,6 +1,29 @@
1
- <%%= form_tag <%= rodauth %>.change_login_path, method: :post do %>
2
- <%%= render "login_field" %>
3
- <%%= render "login_confirm_field" if <%= rodauth %>.require_login_confirmation? %>
4
- <%%= render "password_field" if <%= rodauth %>.change_login_requires_password? %>
5
- <%%= render "submit", value: "Change Login" %>
6
- <%% end %>
1
+ <% content_for :title, rodauth.change_login_page_title %>
2
+
3
+ <%= form_with url: rodauth.change_login_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.label "login", rodauth.login_label, class: "form-label" %>
6
+ <%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
7
+ <%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
8
+ </div>
9
+
10
+ <% if rodauth.require_login_confirmation? %>
11
+ <div class="form-group mb-3">
12
+ <%= form.label "login-confirm", rodauth.login_confirm_label, class: "form-label" %>
13
+ <%= form.email_field rodauth.login_confirm_param, value: params[rodauth.login_confirm_param], id: "login-confirm", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_confirm_param)}", aria: ({ invalid: true, describedby: "login-confirm_error_message" } if rodauth.field_error(rodauth.login_confirm_param)) %>
14
+ <%= content_tag(:span, rodauth.field_error(rodauth.login_confirm_param), class: "invalid-feedback", id: "login-confirm_error_message") if rodauth.field_error(rodauth.login_confirm_param) %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <% if rodauth.change_login_requires_password? %>
19
+ <div class="form-group mb-3">
20
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
21
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
22
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
23
+ </div>
24
+ <% end %>
25
+
26
+ <div class="form-group mb-3">
27
+ <%= form.submit rodauth.change_login_button, class: "btn btn-primary" %>
28
+ </div>
29
+ <% end %>
@@ -1,6 +1,29 @@
1
- <%%= form_tag <%= rodauth %>.change_password_path, method: :post do %>
2
- <%%= render "password_field" if <%= rodauth %>.change_password_requires_password? %>
3
- <%%= render "new_password_field" %>
4
- <%%= render "password_confirm_field" if <%= rodauth %>.require_password_confirmation? %>
5
- <%%= render "submit", value: "Change Password" %>
6
- <%% end %>
1
+ <% content_for :title, rodauth.change_password_page_title %>
2
+
3
+ <%= form_with url: rodauth.change_password_path, method: :post do |form| %>
4
+ <% if rodauth.change_password_requires_password? %>
5
+ <div class="form-group mb-3">
6
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
7
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
8
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
9
+ </div>
10
+ <% end %>
11
+
12
+ <div class="form-group mb-3">
13
+ <%= form.label "new-password", rodauth.new_password_label, class: "form-label" %>
14
+ <%= form.password_field rodauth.new_password_param, value: "", id: "new-password", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.new_password_param)}", aria: ({ invalid: true, describedby: "new-password_error_message" } if rodauth.field_error(rodauth.new_password_param)) %>
15
+ <%= content_tag(:span, rodauth.field_error(rodauth.new_password_param), class: "invalid-feedback", id: "new-password_error_message") if rodauth.field_error(rodauth.new_password_param) %>
16
+ </div>
17
+
18
+ <% if rodauth.require_password_confirmation? %>
19
+ <div class="form-group mb-3">
20
+ <%= form.label "password-confirm", rodauth.password_confirm_label, class: "form-label" %>
21
+ <%= form.password_field rodauth.password_confirm_param, value: "", id: "password-confirm", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_confirm_param)}", aria: ({ invalid: true, describedby: "password-confirm_error_message" } if rodauth.field_error(rodauth.password_confirm_param)) %>
22
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_confirm_param), class: "invalid-feedback", id: "password-confirm_error_message") if rodauth.field_error(rodauth.password_confirm_param) %>
23
+ </div>
24
+ <% end %>
25
+
26
+ <div class="form-group mb-3">
27
+ <%= form.submit rodauth.change_password_button, class: "btn btn-primary" %>
28
+ </div>
29
+ <% end %>
@@ -1,4 +1,15 @@
1
- <%%= form_tag <%= rodauth %>.close_account_path, method: :post do %>
2
- <%%= render "password_field" if <%= rodauth %>.close_account_requires_password? %>
3
- <%%= render "submit", value: "Close Account", class: "btn btn-danger" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.close_account_page_title %>
2
+
3
+ <%= form_with url: rodauth.close_account_path, method: :post do |form| %>
4
+ <% if rodauth.close_account_requires_password? %>
5
+ <div class="form-group mb-3">
6
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
7
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
8
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
9
+ </div>
10
+ <% end %>
11
+
12
+ <div class="form-group mb-3">
13
+ <%= form.submit rodauth.close_account_button, class: "btn btn-danger" %>
14
+ </div>
15
+ <% end %>
@@ -1,4 +1,13 @@
1
- <%%= form_tag <%= rodauth %>.confirm_password_path, method: :post do %>
2
- <%%= render "password_field" %>
3
- <%%= render "submit", value: "Confirm Password" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.confirm_password_page_title %>
2
+
3
+ <%= form_with url: rodauth.confirm_password_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
6
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
7
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
8
+ </div>
9
+
10
+ <div class="form-group mb-3">
11
+ <%= form.submit rodauth.confirm_password_button, class: "btn btn-primary" %>
12
+ </div>
13
+ <% end %>
@@ -1,7 +1,37 @@
1
- <%%= form_tag <%= rodauth %>.create_account_path, method: :post do %>
2
- <%%= render "login_field" %>
3
- <%%= render "login_confirm_field" if <%= rodauth %>.require_login_confirmation? %>
4
- <%%= render "password_field" if <%= rodauth %>.create_account_set_password? %>
5
- <%%= render "password_confirm_field" if <%= rodauth %>.create_account_set_password? && <%= rodauth %>.require_password_confirmation? %>
6
- <%%= render "submit", value: "Create Account" %>
7
- <%% end %>
1
+ <% content_for :title, rodauth.create_account_page_title %>
2
+
3
+ <%= form_with url: rodauth.create_account_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.label "login", rodauth.login_label, class: "form-label" %>
6
+ <%= form.email_field rodauth.login_param, value: params[rodauth.login_param], id: "login", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_param)}", aria: ({ invalid: true, describedby: "login_error_message" } if rodauth.field_error(rodauth.login_param)) %>
7
+ <%= content_tag(:span, rodauth.field_error(rodauth.login_param), class: "invalid-feedback", id: "login_error_message") if rodauth.field_error(rodauth.login_param) %>
8
+ </div>
9
+
10
+ <% if rodauth.require_login_confirmation? %>
11
+ <div class="form-group mb-3">
12
+ <%= form.label "login-confirm", rodauth.login_confirm_label, class: "form-label" %>
13
+ <%= form.email_field rodauth.login_confirm_param, value: params[rodauth.login_confirm_param], id: "login-confirm", autocomplete: "email", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.login_confirm_param)}", aria: ({ invalid: true, describedby: "login-confirm_error_message" } if rodauth.field_error(rodauth.login_confirm_param)) %>
14
+ <%= content_tag(:span, rodauth.field_error(rodauth.login_confirm_param), class: "invalid-feedback", id: "login-confirm_error_message") if rodauth.field_error(rodauth.login_confirm_param) %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <% if rodauth.create_account_set_password? %>
19
+ <div class="form-group mb-3">
20
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
21
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
22
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
23
+ </div>
24
+
25
+ <% if rodauth.require_password_confirmation? %>
26
+ <div class="form-group mb-3">
27
+ <%= form.label "password-confirm", rodauth.password_confirm_label, class: "form-label" %>
28
+ <%= form.password_field rodauth.password_confirm_param, value: "", id: "password-confirm", autocomplete: "new-password", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_confirm_param)}", aria: ({ invalid: true, describedby: "password-confirm_error_message" } if rodauth.field_error(rodauth.password_confirm_param)) %>
29
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_confirm_param), class: "invalid-feedback", id: "password-confirm_error_message") if rodauth.field_error(rodauth.password_confirm_param) %>
30
+ </div>
31
+ <% end %>
32
+ <% end %>
33
+
34
+ <div class="form-group mb-3">
35
+ <%= form.submit rodauth.create_account_button, class: "btn btn-primary" %>
36
+ </div>
37
+ <% end %>
@@ -1,3 +1,7 @@
1
- <%%= form_tag <%= rodauth %>.email_auth_path, method: :post do %>
2
- <%%= render "submit", value: "Login" %>
3
- <%% end %>
1
+ <% content_for :title, rodauth.email_auth_page_title %>
2
+
3
+ <%= form_with url: rodauth.email_auth_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.submit rodauth.login_button, class: "btn btn-primary" %>
6
+ </div>
7
+ <% end %>
@@ -1,3 +1,5 @@
1
- <%%= render "login_form_header" %>
2
- <%%= render "login_form" %>
3
- <%%= render "login_form_footer" %>
1
+ <% content_for :title, rodauth.login_page_title %>
2
+
3
+ <%= render "login_form_header" %>
4
+ <%= render "login_form" %>
5
+ <%= render "login_form_footer" %>
@@ -1,4 +1,16 @@
1
- <%%= form_tag <%= rodauth %>.logout_path, method: :post do %>
2
- <%%= render "global_logout_field" if <%= rodauth %>.features.include?(:active_sessions) %>
3
- <%%= render "submit", value: "Logout", class: "btn btn-warning" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.logout_page_title %>
2
+
3
+ <%= form_with url: rodauth.logout_path, method: :post do |form| %>
4
+ <% if rodauth.features.include?(:active_sessions) %>
5
+ <div class="form-group mb-3">
6
+ <div class="form-check">
7
+ <%= form.check_box rodauth.global_logout_param, id: "global-logout", class: "form-check-input" %>
8
+ <%= form.label "global-logout", rodauth.global_logout_label, class: "form-check-label" %>
9
+ </div>
10
+ </div>
11
+ <% end %>
12
+
13
+ <div class="form-group mb-3">
14
+ <%= form.submit rodauth.logout_button, class: "btn btn-warning" %>
15
+ </div>
16
+ <% end %>
@@ -1,3 +1,5 @@
1
- <%%= render "login_form_header" %>
2
- <%%= <%= rodauth %>.render_multi_phase_login_forms.html_safe %>
3
- <%%= render "login_form_footer" %>
1
+ <% content_for :title, rodauth.multi_phase_login_page_title %>
2
+
3
+ <%= render "login_form_header" %>
4
+ <%== rodauth.render_multi_phase_login_forms %>
5
+ <%= render "login_form_footer" %>
@@ -1,4 +1,17 @@
1
- <%%= form_tag <%= rodauth %>.otp_auth_path, method: :post do %>
2
- <%%= render "otp_auth_code_field" %>
3
- <%%= render "submit", value: "Authenticate Using TOTP" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.otp_auth_page_title %>
2
+
3
+ <%= form_with url: rodauth.otp_auth_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.label "otp-auth-code", rodauth.otp_auth_label, class: "form-label" %>
6
+ <div class="row">
7
+ <div class="col-sm-3">
8
+ <%= form.text_field rodauth.otp_auth_param, value: "", id: "otp-auth-code", autocomplete: "off", inputmode: "numeric", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.otp_auth_param)}", aria: ({ invalid: true, describedby: "otp-auth-code_error_message" } if rodauth.field_error(rodauth.otp_auth_param)) %>
9
+ <%= content_tag(:span, rodauth.field_error(rodauth.otp_auth_param), class: "invalid-feedback", id: "otp-auth-code_error_message") if rodauth.field_error(rodauth.otp_auth_param) %>
10
+ </div>
11
+ </div>
12
+ </div>
13
+
14
+ <div class="form-group mb-3">
15
+ <%= form.submit rodauth.otp_auth_button, class: "btn btn-primary" %>
16
+ </div>
17
+ <% end %>
@@ -1,4 +1,15 @@
1
- <%%= form_tag <%= rodauth %>.otp_disable_path, method: :post do %>
2
- <%%= render "password_field" if <%= rodauth %>.two_factor_modifications_require_password? %>
3
- <%%= render "submit", value: "Disable TOTP Authentication", class: "btn btn-warning" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.otp_disable_page_title %>
2
+
3
+ <%= form_with url: rodauth.otp_disable_path, method: :post do |form| %>
4
+ <% if rodauth.two_factor_modifications_require_password? %>
5
+ <div class="form-group mb-3">
6
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
7
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
8
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
9
+ </div>
10
+ <% end %>
11
+
12
+ <div class="form-group mb-3">
13
+ <%= form.submit rodauth.otp_disable_button, class: "btn btn-warning" %>
14
+ </div>
15
+ <% end %>
@@ -1,23 +1,43 @@
1
- <%%= form_tag <%= rodauth %>.otp_setup_path, method: :post do %>
2
- <%%= hidden_field_tag <%= rodauth %>.otp_setup_param, <%= rodauth %>.otp_user_key, id: "otp-key" %>
3
- <%%= hidden_field_tag <%= rodauth %>.otp_setup_raw_param, <%= rodauth %>.otp_key, id: "otp-hmac-secret" if <%= rodauth %>.otp_keys_use_hmac? %>
1
+ <% content_for :title, rodauth.otp_setup_page_title %>
2
+
3
+ <%= form_with url: rodauth.otp_setup_path, method: :post do |form| %>
4
+ <%= form.hidden_field rodauth.otp_setup_param, value: rodauth.otp_user_key, id: "otp-key" %>
5
+ <%= form.hidden_field rodauth.otp_setup_raw_param, value: rodauth.otp_key, id: "otp-hmac-secret" if rodauth.otp_keys_use_hmac? %>
4
6
 
5
7
  <div class="form-group mb-3">
6
- <p>Secret: <%%= <%= rodauth %>.otp_user_key %></p>
7
- <p>Provisioning URL: <%%= <%= rodauth %>.otp_provisioning_uri %></p>
8
+ <p><%= rodauth.otp_secret_label %>: <%= rodauth.otp_user_key %></p>
9
+ <p><%= rodauth.otp_provisioning_uri_label %>: <%= rodauth.otp_provisioning_uri %></p>
8
10
  </div>
9
11
 
10
12
  <div class="row">
11
13
  <div class="col-lg-6 col-lg">
12
14
  <div class="form-group mb-3">
13
- <p><%%= <%= rodauth %>.otp_qr_code.html_safe %></p>
15
+ <p><%== rodauth.otp_qr_code %></p>
14
16
  </div>
15
17
  </div>
16
18
 
17
19
  <div class="col-lg-6 col-lg">
18
- <%%= render "password_field" if <%= rodauth %>.two_factor_modifications_require_password? %>
19
- <%%= render "otp_auth_code_field" %>
20
- <%%= render "submit", value: "Setup TOTP Authentication" %>
20
+ <% if rodauth.two_factor_modifications_require_password? %>
21
+ <div class="form-group mb-3">
22
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
23
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
24
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
25
+ </div>
26
+ <% end %>
27
+
28
+ <div class="form-group mb-3">
29
+ <%= form.label "otp-auth-code", rodauth.otp_auth_label, class: "form-label" %>
30
+ <div class="row">
31
+ <div class="col-sm-3">
32
+ <%= form.text_field rodauth.otp_auth_param, value: "", id: "otp-auth-code", autocomplete: "off", inputmode: "numeric", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.otp_auth_param)}", aria: ({ invalid: true, describedby: "otp-auth-code_error_message" } if rodauth.field_error(rodauth.otp_auth_param)) %>
33
+ <%= content_tag(:span, rodauth.field_error(rodauth.otp_auth_param), class: "invalid-feedback", id: "otp-auth-code_error_message") if rodauth.field_error(rodauth.otp_auth_param) %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="form-group mb-3">
39
+ <%= form.submit rodauth.otp_setup_button, class: "btn btn-primary" %>
40
+ </div>
21
41
  </div>
22
42
  </div>
23
- <%% end %>
43
+ <% end %>
@@ -1,4 +1,13 @@
1
- <%%= form_tag <%= rodauth %>.recovery_auth_path, method: :post do %>
2
- <%%= render "recovery_code_field" %>
3
- <%%= render "submit", value: "Authenticate via Recovery Code" %>
4
- <%% end %>
1
+ <% content_for :title, rodauth.recovery_auth_page_title %>
2
+
3
+ <%= form_with url: rodauth.recovery_auth_path, method: :post do |form| %>
4
+ <div class="form-group mb-3">
5
+ <%= form.label "recovery-code", rodauth.recovery_codes_label, class: "form-label" %>
6
+ <%= form.text_field rodauth.recovery_codes_param, value: "", id: "recovery-code", autocomplete: "off", required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.recovery_codes_param)}", aria: ({ invalid: true, describedby: "recovery-code_error_message" } if rodauth.field_error(rodauth.recovery_codes_param)) %>
7
+ <%= content_tag(:span, rodauth.field_error(rodauth.recovery_codes_param), class: "invalid-feedback", id: "recovery-code_error_message") if rodauth.field_error(rodauth.recovery_codes_param) %>
8
+ </div>
9
+
10
+ <div class="form-group mb-3">
11
+ <%= form.submit rodauth.recovery_auth_button, class: "btn btn-primary" %>
12
+ </div>
13
+ <% end %>
@@ -1 +1,15 @@
1
- <%%= render "recovery_codes_form" %>
1
+ <% content_for :title, rodauth.recovery_codes_page_title %>
2
+
3
+ <%= form_with url: rodauth.recovery_codes_path, method: :post, data: { turbo: false } do |form| %>
4
+ <% if rodauth.two_factor_modifications_require_password? %>
5
+ <div class="form-group mb-3">
6
+ <%= form.label "password", rodauth.password_label, class: "form-label" %>
7
+ <%= form.password_field rodauth.password_param, value: "", id: "password", autocomplete: rodauth.password_field_autocomplete_value, required: true, class: "form-control #{"is-invalid" if rodauth.field_error(rodauth.password_param)}", aria: ({ invalid: true, describedby: "password_error_message" } if rodauth.field_error(rodauth.password_param)) %>
8
+ <%= content_tag(:span, rodauth.field_error(rodauth.password_param), class: "invalid-feedback", id: "password_error_message") if rodauth.field_error(rodauth.password_param) %>
9
+ </div>
10
+ <% end %>
11
+
12
+ <div class="form-group mb-3">
13
+ <%= form.submit rodauth.recovery_codes_button || rodauth.view_recovery_codes_button, name: (rodauth.add_recovery_codes_param if rodauth.recovery_codes_button), class: "btn btn-primary" %>
14
+ </div>
15
+ <% end %>