rodauth-rails 0.9.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -0
  3. data/README.md +467 -249
  4. data/lib/generators/rodauth/install_generator.rb +17 -0
  5. data/lib/generators/rodauth/templates/app/lib/rodauth_app.rb +41 -30
  6. data/lib/generators/rodauth/templates/app/mailers/rodauth_mailer.rb +3 -3
  7. data/lib/generators/rodauth/templates/app/views/rodauth/_email_auth_request_form.html.erb +1 -1
  8. data/lib/generators/rodauth/templates/app/views/rodauth/_field.html.erb +2 -2
  9. data/lib/generators/rodauth/templates/app/views/rodauth/_field_error.html.erb +2 -2
  10. data/lib/generators/rodauth/templates/app/views/rodauth/_global_logout_field.html.erb +2 -2
  11. data/lib/generators/rodauth/templates/app/views/rodauth/_login_confirm_field.html.erb +3 -3
  12. data/lib/generators/rodauth/templates/app/views/rodauth/_login_display.html.erb +3 -3
  13. data/lib/generators/rodauth/templates/app/views/rodauth/_login_field.html.erb +3 -3
  14. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form.html.erb +3 -3
  15. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_footer.html.erb +2 -2
  16. data/lib/generators/rodauth/templates/app/views/rodauth/_login_form_header.html.erb +2 -2
  17. data/lib/generators/rodauth/templates/app/views/rodauth/_login_hidden_field.html.erb +1 -1
  18. data/lib/generators/rodauth/templates/app/views/rodauth/_new_password_field.html.erb +3 -3
  19. data/lib/generators/rodauth/templates/app/views/rodauth/_otp_auth_code_field.html.erb +3 -3
  20. data/lib/generators/rodauth/templates/app/views/rodauth/_password_confirm_field.html.erb +3 -3
  21. data/lib/generators/rodauth/templates/app/views/rodauth/_password_field.html.erb +3 -3
  22. data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_code_field.html.erb +3 -3
  23. data/lib/generators/rodauth/templates/app/views/rodauth/_recovery_codes_form.html.erb +4 -4
  24. data/lib/generators/rodauth/templates/app/views/rodauth/_sms_code_field.html.erb +3 -3
  25. data/lib/generators/rodauth/templates/app/views/rodauth/_sms_phone_field.html.erb +3 -3
  26. data/lib/generators/rodauth/templates/app/views/rodauth/_submit.html.erb +1 -1
  27. data/lib/generators/rodauth/templates/app/views/rodauth/add_recovery_codes.html.erb +2 -2
  28. data/lib/generators/rodauth/templates/app/views/rodauth/change_login.html.erb +3 -3
  29. data/lib/generators/rodauth/templates/app/views/rodauth/change_password.html.erb +3 -3
  30. data/lib/generators/rodauth/templates/app/views/rodauth/close_account.html.erb +2 -2
  31. data/lib/generators/rodauth/templates/app/views/rodauth/confirm_password.html.erb +1 -1
  32. data/lib/generators/rodauth/templates/app/views/rodauth/create_account.html.erb +4 -4
  33. data/lib/generators/rodauth/templates/app/views/rodauth/email_auth.html.erb +1 -1
  34. data/lib/generators/rodauth/templates/app/views/rodauth/logout.html.erb +2 -2
  35. data/lib/generators/rodauth/templates/app/views/rodauth/multi_phase_login.html.erb +1 -1
  36. data/lib/generators/rodauth/templates/app/views/rodauth/otp_auth.html.erb +1 -1
  37. data/lib/generators/rodauth/templates/app/views/rodauth/otp_disable.html.erb +2 -2
  38. data/lib/generators/rodauth/templates/app/views/rodauth/otp_setup.html.erb +9 -9
  39. data/lib/generators/rodauth/templates/app/views/rodauth/recovery_auth.html.erb +1 -1
  40. data/lib/generators/rodauth/templates/app/views/rodauth/remember.html.erb +5 -5
  41. data/lib/generators/rodauth/templates/app/views/rodauth/reset_password.html.erb +2 -2
  42. data/lib/generators/rodauth/templates/app/views/rodauth/reset_password_request.html.erb +2 -2
  43. data/lib/generators/rodauth/templates/app/views/rodauth/sms_auth.html.erb +1 -1
  44. data/lib/generators/rodauth/templates/app/views/rodauth/sms_confirm.html.erb +1 -1
  45. data/lib/generators/rodauth/templates/app/views/rodauth/sms_disable.html.erb +2 -2
  46. data/lib/generators/rodauth/templates/app/views/rodauth/sms_request.html.erb +1 -1
  47. data/lib/generators/rodauth/templates/app/views/rodauth/sms_setup.html.erb +2 -2
  48. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_auth.html.erb +1 -1
  49. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_disable.html.erb +2 -2
  50. data/lib/generators/rodauth/templates/app/views/rodauth/two_factor_manage.html.erb +6 -6
  51. data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account.html.erb +2 -2
  52. data/lib/generators/rodauth/templates/app/views/rodauth/unlock_account_request.html.erb +1 -1
  53. data/lib/generators/rodauth/templates/app/views/rodauth/verify_account.html.erb +3 -3
  54. data/lib/generators/rodauth/templates/app/views/rodauth/verify_account_resend.html.erb +2 -2
  55. data/lib/generators/rodauth/templates/app/views/rodauth/verify_login_change.html.erb +1 -1
  56. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_auth.html.erb +7 -7
  57. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_remove.html.erb +6 -6
  58. data/lib/generators/rodauth/templates/app/views/rodauth/webauthn_setup.html.erb +7 -7
  59. data/lib/generators/rodauth/templates/app/views/rodauth_mailer/unlock_account.text.erb +1 -1
  60. data/lib/generators/rodauth/views_generator.rb +25 -4
  61. data/lib/rodauth/rails.rb +36 -4
  62. data/lib/rodauth/rails/app.rb +19 -21
  63. data/lib/rodauth/rails/app/flash.rb +2 -8
  64. data/lib/rodauth/rails/app/middleware.rb +20 -10
  65. data/lib/rodauth/rails/auth.rb +37 -0
  66. data/lib/rodauth/rails/controller_methods.rb +1 -5
  67. data/lib/rodauth/rails/feature.rb +17 -210
  68. data/lib/rodauth/rails/feature/base.rb +62 -0
  69. data/lib/rodauth/rails/feature/callbacks.rb +61 -0
  70. data/lib/rodauth/rails/feature/csrf.rb +65 -0
  71. data/lib/rodauth/rails/feature/email.rb +30 -0
  72. data/lib/rodauth/rails/feature/instrumentation.rb +71 -0
  73. data/lib/rodauth/rails/feature/render.rb +48 -0
  74. data/lib/rodauth/rails/version.rb +1 -1
  75. data/rodauth-rails.gemspec +1 -1
  76. metadata +12 -6
  77. data/lib/generators/rodauth/mailer_generator.rb +0 -37
@@ -10,6 +10,15 @@ module Rodauth
10
10
  include ::ActiveRecord::Generators::Migration
11
11
  include MigrationHelpers
12
12
 
13
+ MAILER_VIEWS = %w[
14
+ email_auth
15
+ password_changed
16
+ reset_password
17
+ unlock_account
18
+ verify_account
19
+ verify_login_change
20
+ ]
21
+
13
22
  source_root "#{__dir__}/templates"
14
23
  namespace "rodauth:install"
15
24
 
@@ -47,6 +56,14 @@ module Rodauth
47
56
  template "app/models/account.rb"
48
57
  end
49
58
 
59
+ def create_mailer
60
+ template "app/mailers/rodauth_mailer.rb"
61
+
62
+ MAILER_VIEWS.each do |view|
63
+ template "app/views/rodauth_mailer/#{view}.text.erb"
64
+ end
65
+ end
66
+
50
67
  private
51
68
 
52
69
  def sequel_uri_scheme
@@ -2,10 +2,10 @@ class RodauthApp < Rodauth::Rails::App
2
2
  configure do
3
3
  # List of authentication features that are loaded.
4
4
  enable :create_account, :verify_account, :verify_account_grace_period,
5
- :login, :logout<%= ", :remember" unless jwt? %>,
5
+ :login, :logout<%= ", :remember" unless jwt? %><%= ", :json" if json? %><%= ", :jwt" if jwt? %>,
6
6
  :reset_password, :change_password, :change_password_notify,
7
7
  :change_login, :verify_login_change,
8
- :close_account<%= ", :json" if json? %><%= ", :jwt" if jwt? %>
8
+ :close_account
9
9
 
10
10
  # See the Rodauth documentation for the list of available config options:
11
11
  # http://rodauth.jeremyevans.net/documentation.html
@@ -23,6 +23,10 @@ class RodauthApp < Rodauth::Rails::App
23
23
 
24
24
  # Accept only JSON requests.
25
25
  only_json? true
26
+
27
+ # Handle login and password confirmation fields on the client side.
28
+ # require_password_confirmation? false
29
+ # require_login_confirmation? false
26
30
  <% end -%>
27
31
 
28
32
  # Specify the controller used for view rendering and CSRF verification.
@@ -54,35 +58,29 @@ class RodauthApp < Rodauth::Rails::App
54
58
  # already_logged_in { redirect login_redirect }
55
59
 
56
60
  # ==> Emails
57
- # Uncomment the lines below once you've imported mailer views.
58
- # create_reset_password_email do
59
- # RodauthMailer.reset_password(email_to, reset_password_email_link)
60
- # end
61
- # create_verify_account_email do
62
- # RodauthMailer.verify_account(email_to, verify_account_email_link)
63
- # end
64
- # create_verify_login_change_email do |login|
65
- # RodauthMailer.verify_login_change(login, verify_login_change_old_login, verify_login_change_new_login, verify_login_change_email_link)
66
- # end
67
- # create_password_changed_email do
68
- # RodauthMailer.password_changed(email_to)
61
+ # Use a custom mailer for delivering authentication emails.
62
+ create_reset_password_email do
63
+ RodauthMailer.reset_password(email_to, reset_password_email_link)
64
+ end
65
+ create_verify_account_email do
66
+ RodauthMailer.verify_account(email_to, verify_account_email_link)
67
+ end
68
+ create_verify_login_change_email do |login|
69
+ RodauthMailer.verify_login_change(login, verify_login_change_old_login, verify_login_change_new_login, verify_login_change_email_link)
70
+ end
71
+ create_password_changed_email do
72
+ RodauthMailer.password_changed(email_to)
73
+ end
74
+ # create_email_auth_email do
75
+ # RodauthMailer.email_auth(email_to, email_auth_email_link)
69
76
  # end
70
- # # create_email_auth_email do
71
- # # RodauthMailer.email_auth(email_to, email_auth_email_link)
72
- # # end
73
- # # create_unlock_account_email do
74
- # # RodauthMailer.unlock_account(email_to, unlock_account_email_link)
75
- # # end
76
- # send_email do |email|
77
- # # queue email delivery on the mailer after the transaction commits
78
- # db.after_commit { email.deliver_later }
77
+ # create_unlock_account_email do
78
+ # RodauthMailer.unlock_account(email_to, unlock_account_email_link)
79
79
  # end
80
-
81
- # In the meantime, you can tweak settings for emails created by Rodauth.
82
- # email_subject_prefix "[MyApp] "
83
- # email_from "noreply@myapp.com"
84
- # send_email(&:deliver_later)
85
- # reset_password_email_body { "Click here to reset your password: #{reset_password_email_link}" }
80
+ send_email do |email|
81
+ # queue email delivery on the mailer after the transaction commits
82
+ db.after_commit { email.deliver_later }
83
+ end
86
84
 
87
85
  # ==> Flash
88
86
  <% unless json? || jwt? -%>
@@ -151,14 +149,25 @@ class RodauthApp < Rodauth::Rails::App
151
149
  # verify_account_grace_period 3.days
152
150
  # reset_password_deadline_interval Hash[hours: 6]
153
151
  # verify_login_change_deadline_interval Hash[days: 2]
152
+ <% unless jwt? -%>
154
153
  # remember_deadline_interval Hash[days: 30]
154
+ <% end -%>
155
155
  end
156
156
 
157
157
  # ==> Multiple configurations
158
158
  # configure(:admin) do
159
- # enable :http_basic_auth # enable different set of features
159
+ # # ... enable features ...
160
160
  # prefix "/admin"
161
161
  # session_key_prefix "admin_"
162
+ # # remember_cookie_key "_admin_remember" # if using remember feature
163
+ #
164
+ # # search views in `app/views/admin/rodauth` directory
165
+ # rails_controller { Admin::RodauthController }
166
+ #
167
+ # # use separate tables (requires creating the new tables)
168
+ # methods.grep(/_table$/) do |table_method|
169
+ # public_send(table_method) { :"admin_#{super()}" }
170
+ # end
162
171
  # end
163
172
 
164
173
  route do |r|
@@ -187,6 +196,8 @@ class RodauthApp < Rodauth::Rails::App
187
196
  # unless rodauth(:admin).logged_in?
188
197
  # rodauth(:admin).require_http_basic_auth
189
198
  # end
199
+ #
200
+ # r.pass # allow the Rails app to handle other "/admin/*" requests
190
201
  # end
191
202
  end
192
203
  end
@@ -1,4 +1,4 @@
1
- class <%= options[:name].camelize %>Mailer < ApplicationMailer
1
+ class RodauthMailer < ApplicationMailer
2
2
  def verify_account(recipient, email_link)
3
3
  @email_link = email_link
4
4
 
@@ -25,13 +25,13 @@ class <%= options[:name].camelize %>Mailer < ApplicationMailer
25
25
 
26
26
  # def email_auth(recipient, email_link)
27
27
  # @email_link = email_link
28
-
28
+ #
29
29
  # mail to: recipient
30
30
  # end
31
31
 
32
32
  # def unlock_account(recipient, email_link)
33
33
  # @email_link = email_link
34
-
34
+ #
35
35
  # mail to: recipient
36
36
  # end
37
37
  end
@@ -1,4 +1,4 @@
1
- <%%= form_tag rodauth.email_auth_request_path, method: :post do %>
1
+ <%%= form_tag <%= rodauth %>.email_auth_request_path, method: :post do %>
2
2
  <%%= render "login_hidden_field" %>
3
3
  <%%= render "submit", value: "Send Login Link Via Email" %>
4
4
  <%% end %>
@@ -4,7 +4,7 @@
4
4
  autocomplete: local_assigns[:autocomplete],
5
5
  inputmode: local_assigns[:inputmode],
6
6
  required: local_assigns[:required] != false,
7
- class: "#{local_assigns[:class] || "form-control"} #{"is-invalid" if rodauth.field_error(name)}",
8
- aria: ({ invalid: "true", describedby: "#{name}_error_message" } if rodauth.field_error(name)) %>
7
+ class: "#{local_assigns[:class] || "form-control"} #{"is-invalid" if <%= rodauth %>.field_error(name)}",
8
+ aria: ({ invalid: "true", describedby: "#{name}_error_message" } if <%= rodauth %>.field_error(name)) %>
9
9
 
10
10
  <%%= render "field_error", name: name unless local_assigns[:skip_error_message] %>
@@ -1,3 +1,3 @@
1
- <%% if rodauth.field_error(name) %>
2
- <div class="invalid-feedback" id="<%%= name %>_error_message"><%%= rodauth.field_error(name) %></div>
1
+ <%% if <%= rodauth %>.field_error(name) %>
2
+ <div class="invalid-feedback" id="<%%= name %>_error_message"><%%= <%= rodauth %>.field_error(name) %></div>
3
3
  <%% end %>
@@ -1,6 +1,6 @@
1
- <div class="form-group">
1
+ <div class="form-group mb-3">
2
2
  <div class="form-check">
3
- <%%= check_box_tag rodauth.global_logout_param, "t", false, id: "global-logout", class: "form-check-input" %>
3
+ <%%= check_box_tag <%= rodauth %>.global_logout_param, "t", false, id: "global-logout", class: "form-check-input" %>
4
4
  <%%= label_tag "global-logout", "Logout all Logged In Sessons?", class: "form-check-label" %>
5
5
  </div>
6
6
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "login-confirm", "Confirm Login" %>
3
- <%%= render "field", name: rodauth.login_confirm_param, id: "login-confirm", type: :email, autocomplete: "email" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "login-confirm", "Confirm Login", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.login_confirm_param, id: "login-confirm", type: :email, autocomplete: "email" %>
4
4
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "login", "Login" %>
3
- <%%= email_field_tag rodauth.login_param, params[rodauth.login_param], id: "login", readonly: true, class: "form-control-plaintext" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "login", "Login", class: "form-label" %>
3
+ <%%= email_field_tag <%= rodauth %>.login_param, params[<%= rodauth %>.login_param], id: "login", readonly: true, class: "form-control-plaintext" %>
4
4
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "login", "Login" %>
3
- <%%= render "field", name: rodauth.login_param, id: "login", type: :email, autocomplete: "email" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "login", "Login", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.login_param, id: "login", type: :email, autocomplete: "email" %>
4
4
  </div>
@@ -1,9 +1,9 @@
1
- <%%= form_tag rodauth.login_path, method: :post do %>
2
- <%% if rodauth.skip_login_field_on_login? %>
1
+ <%%= form_tag <%= rodauth %>.login_path, method: :post do %>
2
+ <%% if <%= rodauth %>.skip_login_field_on_login? %>
3
3
  <%%= render "login_display" %>
4
4
  <%% else %>
5
5
  <%%= render "login_field" %>
6
6
  <%% end %>
7
- <%%= render "password_field" unless rodauth.skip_password_field_on_login? %>
7
+ <%%= render "password_field" unless <%= rodauth %>.skip_password_field_on_login? %>
8
8
  <%%= render "submit", value: "Login" %>
9
9
  <%% end %>
@@ -1,7 +1,7 @@
1
- <%% unless rodauth.login_form_footer_links.empty? %>
1
+ <%% unless <%= rodauth %>.login_form_footer_links.empty? %>
2
2
  <h2>Other Options</h2>
3
3
  <ul>
4
- <%% rodauth.login_form_footer_links.sort.each do |_, link, text| %>
4
+ <%% <%= rodauth %>.login_form_footer_links.sort.each do |_, link, text| %>
5
5
  <li><%%= link_to text, link %></li>
6
6
  <%% end %>
7
7
  </ul>
@@ -1,3 +1,3 @@
1
- <%% if rodauth.field_error("password") && rodauth.features.include?(:reset_password) %>
2
- <%%= render template: "<%= options[:directory] %>/reset_password_request", layout: false %>
1
+ <%% if <%= rodauth %>.field_error("password") && <%= rodauth %>.features.include?(:reset_password) %>
2
+ <%%= render template: "<%= directory %>/reset_password_request", layout: false %>
3
3
  <%% end %>
@@ -1 +1 @@
1
- <%%= hidden_field_tag rodauth.login_param, params[rodauth.login_param] %>
1
+ <%%= hidden_field_tag <%= rodauth %>.login_param, params[<%= rodauth %>.login_param] %>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "new-password", "New Password" %>
3
- <%%= render "field", name: rodauth.new_password_param, id: "new-password", type: "password", value: "", autocomplete: "new-password" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "new-password", "New Password", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.new_password_param, id: "new-password", type: "password", value: "", autocomplete: "new-password" %>
4
4
  </div>
@@ -1,8 +1,8 @@
1
- <div class="form-group">
2
- <%%= label_tag "otp-auth-code", "Authentication Code" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "otp-auth-code", "Authentication Code", class: "form-label" %>
3
3
  <div class="row">
4
4
  <div class="col-sm-3">
5
- <%%= render "field", name: rodauth.otp_auth_param, id: "otp-auth-code", value: "", autocomplete: "off", inputmode: "numeric" %>
5
+ <%%= render "field", name: <%= rodauth %>.otp_auth_param, id: "otp-auth-code", value: "", autocomplete: "off", inputmode: "numeric" %>
6
6
  </div>
7
7
  </div>
8
8
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "password-confirm", "Confirm Password" %>
3
- <%%= render "field", name: rodauth.password_confirm_param, id: "password-confirm", type: :password, value: "", autocomplete: "new-password" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "password-confirm", "Confirm Password", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.password_confirm_param, id: "password-confirm", type: :password, value: "", autocomplete: "new-password" %>
4
4
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "password", "Password" %>
3
- <%%= render "field", name: rodauth.password_param, id: "password", type: :password, value: "", autocomplete: rodauth.password_field_autocomplete_value %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "password", "Password", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.password_param, id: "password", type: :password, value: "", autocomplete: <%= rodauth %>.password_field_autocomplete_value %>
4
4
  </div>
@@ -1,4 +1,4 @@
1
- <div class="form-group">
2
- <%%= label_tag "recovery_code", "Recovery Code" %>
3
- <%%= render "field", name: rodauth.recovery_codes_param, id: "recovery_code", value: "", autocomplete: "off" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "recovery_code", "Recovery Code", class: "form-label" %>
3
+ <%%= render "field", name: <%= rodauth %>.recovery_codes_param, id: "recovery_code", value: "", autocomplete: "off" %>
4
4
  </div>
@@ -1,6 +1,6 @@
1
- <%%= form_tag rodauth.recovery_codes_path, method: :post do %>
2
- <%%= render "password_field" if rodauth.two_factor_modifications_require_password? %>
1
+ <%%= form_tag <%= rodauth %>.recovery_codes_path, method: :post do %>
2
+ <%%= render "password_field" if <%= rodauth %>.two_factor_modifications_require_password? %>
3
3
  <%%= render "submit",
4
- value: rodauth.recovery_codes_button || "View Authentication Recovery Codes",
5
- name: (rodauth.add_recovery_codes_param if rodauth.recovery_codes_button) %>
4
+ value: <%= rodauth %>.recovery_codes_button || "View Authentication Recovery Codes",
5
+ name: (<%= rodauth %>.add_recovery_codes_param if <%= rodauth %>.recovery_codes_button) %>
6
6
  <%% end %>
@@ -1,8 +1,8 @@
1
- <div class="form-group">
2
- <%%= label_tag "sms-code", "SMS Code" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "sms-code", "SMS Code", class: "form-label" %>
3
3
  <div class="row">
4
4
  <div class="col-sm-3">
5
- <%%= render "field", name: rodauth.sms_code_param, id: "sms-code", value: "", autocomplete: "one-time-code", inputmode: "numeric" %>
5
+ <%%= render "field", name: <%= rodauth %>.sms_code_param, id: "sms-code", value: "", autocomplete: "one-time-code", inputmode: "numeric" %>
6
6
  </div>
7
7
  </div>
8
8
  </div>
@@ -1,8 +1,8 @@
1
- <div class="form-group">
2
- <%%= label_tag "sms-phone", "Phone Number" %>
1
+ <div class="form-group mb-3">
2
+ <%%= label_tag "sms-phone", "Phone Number", class: "form-label" %>
3
3
  <div class="row">
4
4
  <div class="col-sm-3">
5
- <%%= render "field", name: rodauth.sms_phone_param, id: "sms-phone", type: :tel, autocomplete: "tel" %>
5
+ <%%= render "field", name: <%= rodauth %>.sms_phone_param, id: "sms-phone", type: :tel, autocomplete: "tel" %>
6
6
  </div>
7
7
  </div>
8
8
  </div>
@@ -1,3 +1,3 @@
1
- <div class="form-group">
1
+ <div class="form-group mb-3">
2
2
  <%%= submit_tag local_assigns[:value], name: local_assigns[:name], class: local_assigns[:class] || "btn btn-primary" %>
3
3
  </div>
@@ -1,6 +1,6 @@
1
- <pre id="recovery-codes"><%%= rodauth.recovery_codes.map { |s| h(s) }.join("\n\n") %></pre>
1
+ <pre id="recovery-codes"><%%= <%= rodauth %>.recovery_codes.map { |s| h(s) }.join("\n\n") %></pre>
2
2
 
3
- <%% if rodauth.can_add_recovery_codes? %>
3
+ <%% if <%= rodauth %>.can_add_recovery_codes? %>
4
4
  <h2>Add Additional Recovery Codes</h2>
5
5
  <%%= render "recovery_codes_form" %>
6
6
  <%% end %>
@@ -1,6 +1,6 @@
1
- <%%= form_tag rodauth.change_login_path, method: :post do %>
1
+ <%%= form_tag <%= rodauth %>.change_login_path, method: :post do %>
2
2
  <%%= render "login_field" %>
3
- <%%= render "login_confirm_field" if rodauth.require_login_confirmation? %>
4
- <%%= render "password_field" if rodauth.change_login_requires_password? %>
3
+ <%%= render "login_confirm_field" if <%= rodauth %>.require_login_confirmation? %>
4
+ <%%= render "password_field" if <%= rodauth %>.change_login_requires_password? %>
5
5
  <%%= render "submit", value: "Change Login" %>
6
6
  <%% end %>
@@ -1,6 +1,6 @@
1
- <%%= form_tag rodauth.change_password_path, method: :post do %>
2
- <%%= render "password_field" if rodauth.change_password_requires_password? %>
1
+ <%%= form_tag <%= rodauth %>.change_password_path, method: :post do %>
2
+ <%%= render "password_field" if <%= rodauth %>.change_password_requires_password? %>
3
3
  <%%= render "new_password_field" %>
4
- <%%= render "password_confirm_field" if rodauth.require_password_confirmation? %>
4
+ <%%= render "password_confirm_field" if <%= rodauth %>.require_password_confirmation? %>
5
5
  <%%= render "submit", value: "Change Password" %>
6
6
  <%% end %>
@@ -1,4 +1,4 @@
1
- <%%= form_tag rodauth.close_account_path, method: :post do %>
2
- <%%= render "password_field" if rodauth.close_account_requires_password? %>
1
+ <%%= form_tag <%= rodauth %>.close_account_path, method: :post do %>
2
+ <%%= render "password_field" if <%= rodauth %>.close_account_requires_password? %>
3
3
  <%%= render "submit", value: "Close Account", class: "btn btn-danger" %>
4
4
  <%% end %>
@@ -1,4 +1,4 @@
1
- <%%= form_tag rodauth.confirm_password_path, method: :post do %>
1
+ <%%= form_tag <%= rodauth %>.confirm_password_path, method: :post do %>
2
2
  <%%= render "password_field" %>
3
3
  <%%= render "submit", value: "Confirm Password" %>
4
4
  <%% end %>
@@ -1,7 +1,7 @@
1
- <%%= form_tag rodauth.create_account_path, method: :post do %>
1
+ <%%= form_tag <%= rodauth %>.create_account_path, method: :post do %>
2
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? %>
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
6
  <%%= render "submit", value: "Create Account" %>
7
7
  <%% end %>
@@ -1,3 +1,3 @@
1
- <%%= form_tag rodauth.email_auth_path, method: :post do %>
1
+ <%%= form_tag <%= rodauth %>.email_auth_path, method: :post do %>
2
2
  <%%= render "submit", value: "Login" %>
3
3
  <%% end %>
@@ -1,4 +1,4 @@
1
- <%%= form_tag rodauth.logout_path, method: :post do %>
2
- <%%= render "global_logout_field" if rodauth.features.include?(:active_sessions) %>
1
+ <%%= form_tag <%= rodauth %>.logout_path, method: :post do %>
2
+ <%%= render "global_logout_field" if <%= rodauth %>.features.include?(:active_sessions) %>
3
3
  <%%= render "submit", value: "Logout", class: "btn btn-warning" %>
4
4
  <%% end %>
@@ -1,3 +1,3 @@
1
1
  <%%= render "login_form_header" %>
2
- <%%= rodauth.render_multi_phase_login_forms.html_safe %>
2
+ <%%= <%= rodauth %>.render_multi_phase_login_forms.html_safe %>
3
3
  <%%= render "login_form_footer" %>