rodauth_phlex 0.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.standard.yml +3 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +132 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +90 -0
  8. data/Rakefile +10 -0
  9. data/lib/rodauth_phlex/component.rb +15 -0
  10. data/lib/rodauth_phlex/components/add_recovery_codes.rb +21 -0
  11. data/lib/rodauth_phlex/components/button.rb +33 -0
  12. data/lib/rodauth_phlex/components/change_login.rb +22 -0
  13. data/lib/rodauth_phlex/components/email_auth_request_form.rb +20 -0
  14. data/lib/rodauth_phlex/components/formatted_field_error.rb +23 -0
  15. data/lib/rodauth_phlex/components/global_logout_field.rb +20 -0
  16. data/lib/rodauth_phlex/components/input_field.rb +74 -0
  17. data/lib/rodauth_phlex/components/login_confirm_field.rb +18 -0
  18. data/lib/rodauth_phlex/components/login_display.rb +19 -0
  19. data/lib/rodauth_phlex/components/login_field.rb +18 -0
  20. data/lib/rodauth_phlex/components/login_form.rb +25 -0
  21. data/lib/rodauth_phlex/components/login_form_footer.rb +20 -0
  22. data/lib/rodauth_phlex/components/login_hidden_field.rb +16 -0
  23. data/lib/rodauth_phlex/components/otp_auth_code_field.rb +22 -0
  24. data/lib/rodauth_phlex/components/password_confirm_field.rb +18 -0
  25. data/lib/rodauth_phlex/components/password_field.rb +18 -0
  26. data/lib/rodauth_phlex/components/recovery_codes.rb +24 -0
  27. data/lib/rodauth_phlex/components/sms_code_field.rb +22 -0
  28. data/lib/rodauth_phlex/components/webauthn_autofill.rb +26 -0
  29. data/lib/rodauth_phlex/components.rb +27 -0
  30. data/lib/rodauth_phlex/email.rb +23 -0
  31. data/lib/rodauth_phlex/emails/email_auth_email.rb +21 -0
  32. data/lib/rodauth_phlex/emails/otp_disabled_email.rb +18 -0
  33. data/lib/rodauth_phlex/emails/otp_locked_out_email.rb +25 -0
  34. data/lib/rodauth_phlex/emails/otp_setup_email.rb +18 -0
  35. data/lib/rodauth_phlex/emails/otp_unlock_failed_email.rb +24 -0
  36. data/lib/rodauth_phlex/emails/otp_unlocked_email.rb +18 -0
  37. data/lib/rodauth_phlex/emails/password_changed_email.rb +18 -0
  38. data/lib/rodauth_phlex/emails/reset_password_email.rb +21 -0
  39. data/lib/rodauth_phlex/emails/reset_password_notify_email.rb +21 -0
  40. data/lib/rodauth_phlex/emails/unlock_account_email.rb +21 -0
  41. data/lib/rodauth_phlex/emails/verify_account_email.rb +20 -0
  42. data/lib/rodauth_phlex/emails/verify_login_change_email.rb +25 -0
  43. data/lib/rodauth_phlex/emails/webauthn_authenticator_added_email.rb +19 -0
  44. data/lib/rodauth_phlex/emails/webauthn_authenticator_removed_email.rb +19 -0
  45. data/lib/rodauth_phlex/emails.rb +22 -0
  46. data/lib/rodauth_phlex/feature.rb +71 -0
  47. data/lib/rodauth_phlex/version.rb +5 -0
  48. data/lib/rodauth_phlex/view.rb +17 -0
  49. data/lib/rodauth_phlex/views/change_password.rb +25 -0
  50. data/lib/rodauth_phlex/views/close_account.rb +20 -0
  51. data/lib/rodauth_phlex/views/confirm_password.rb +20 -0
  52. data/lib/rodauth_phlex/views/create_account.rb +23 -0
  53. data/lib/rodauth_phlex/views/email_auth.rb +19 -0
  54. data/lib/rodauth_phlex/views/login.rb +17 -0
  55. data/lib/rodauth_phlex/views/logout.rb +19 -0
  56. data/lib/rodauth_phlex/views/multi_phase_login.rb +17 -0
  57. data/lib/rodauth_phlex/views/otp_auth.rb +21 -0
  58. data/lib/rodauth_phlex/views/otp_disable.rb +20 -0
  59. data/lib/rodauth_phlex/views/otp_setup.rb +39 -0
  60. data/lib/rodauth_phlex/views/otp_unlock.rb +24 -0
  61. data/lib/rodauth_phlex/views/otp_unlock_not_available.rb +23 -0
  62. data/lib/rodauth_phlex/views/recovery_auth.rb +23 -0
  63. data/lib/rodauth_phlex/views/remember.rb +33 -0
  64. data/lib/rodauth_phlex/views/reset_password.rb +21 -0
  65. data/lib/rodauth_phlex/views/reset_password_request.rb +25 -0
  66. data/lib/rodauth_phlex/views/sms_auth.rb +20 -0
  67. data/lib/rodauth_phlex/views/sms_confirm.rb +20 -0
  68. data/lib/rodauth_phlex/views/sms_disable.rb +20 -0
  69. data/lib/rodauth_phlex/views/sms_request.rb +19 -0
  70. data/lib/rodauth_phlex/views/sms_setup.rb +30 -0
  71. data/lib/rodauth_phlex/views/two_factor_auth.rb +19 -0
  72. data/lib/rodauth_phlex/views/two_factor_disable.rb +20 -0
  73. data/lib/rodauth_phlex/views/two_factor_manage.rb +28 -0
  74. data/lib/rodauth_phlex/views/unlock_account.rb +21 -0
  75. data/lib/rodauth_phlex/views/unlock_account_request.rb +21 -0
  76. data/lib/rodauth_phlex/views/verify_account.rb +21 -0
  77. data/lib/rodauth_phlex/views/verify_account_resend.rb +25 -0
  78. data/lib/rodauth_phlex/views/verify_login_change.rb +19 -0
  79. data/lib/rodauth_phlex/views/webauthn_auth.rb +27 -0
  80. data/lib/rodauth_phlex/views/webauthn_remove.rb +33 -0
  81. data/lib/rodauth_phlex/views/webauthn_setup.rb +28 -0
  82. data/lib/rodauth_phlex/views.rb +39 -0
  83. data/lib/rodauth_phlex.rb +13 -0
  84. metadata +162 -0
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/confirm-password.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class ConfirmPassword < RodauthPhlex::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "confirm-password-form") do
13
+ safe_html rodauth.confirm_password_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ render PasswordField(rodauth)
16
+ Button(rodauth, rodauth.confirm_password_button)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/create-account.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class CreateAccount < RodauthPhlex::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "create-account-form") do
13
+ safe_html rodauth.create_account_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ LoginField(rodauth)
16
+ LoginConfirmField(rodauth) if rodauth.require_login_confirmation?
17
+ PasswordField(rodauth) if rodauth.create_account_set_password?
18
+ PasswordConfirmField(rodauth) if rodauth.create_account_set_password? && rodauth.require_password_confirmation?
19
+ Button(rodauth, rodauth.create_account_button)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/email-auth.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class EmailAuth < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "email-auth-form") do
13
+ safe_html rodauth.email_auth_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ Button(rodauth, rodauth.login_button)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/login.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class Login < RodauthPhlex::View
11
+ def view_template
12
+ safe_html rodauth.login_form_header
13
+ LoginForm(rodauth)
14
+ safe_html rodauth.login_form_footer
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/logout.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class Logout < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "logout-form") do
13
+ safe_html rodauth.logout_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ Button(rodauth, rodauth.logout_button, class: "btn btn-warning")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/multi-phase-login.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class MultiPhaseLogin < Rodauth::View
11
+ def view_template
12
+ safe_html rodauth.login_form_header
13
+ safe_html rodauth.render_multi_phase_login_forms
14
+ safe_html rodauth.login_form_footer
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/otp-auth.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class OtpAuth < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "otp-auth-form") do
13
+ safe_html rodauth.otp_auth_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ OtpAuthCodeField(rodauth)
16
+ Button(rodauth, rodauth.otp_auth_button)
17
+ end
18
+ safe_html rodauth.otp_auth_form_footer
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/otp-disable.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class OtpDisable < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "otp-disable-form") do
13
+ safe_html rodauth.otp_disable_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth) if rodauth.two_factor_modifications_require_password?
16
+ Button(rodauth, rodauth.otp_disable_button, class: "btn btn-warning")
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/otp-setup.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class OtpSetup < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "otp-setup-form") do
13
+ safe_html rodauth.otp_setup_additional_form_tags
14
+ input(type: "hidden", id: "otp-key", name: rodauth.otp_setup_param, value: rodauth.otp_user_key)
15
+ input(type: "hidden", id: "otp-hmac-secret", name: rodauth.otp_setup_raw_param, value: rodauth.otp_key) if rodauth.otp_keys_use_hmac?
16
+ safe_html rodauth.csrf_tag
17
+
18
+ div(class: "form-group mb-3") do
19
+ p { "#{rodauth.otp_secret_label}: #{rodauth.otp_user_key}" }
20
+ p { "#{rodauth.otp_provisioning_uri_label}: #{rodauth.otp_provisioning_uri}" }
21
+ end
22
+
23
+ div(class: "row") do
24
+ div(class: "col-lg-6 col-lg") do
25
+ div(class: "form-group mb-3") do
26
+ p { rodauth.otp_qr_code }
27
+ end
28
+ end
29
+
30
+ div(class: "col-lg-6 col-lg") do
31
+ PasswordField(rodauth) if rodauth.two_factor_modifications_require_password?
32
+ OtpAuthCodeField(rodauth)
33
+ Button(rodauth, rodauth.otp_setup_button)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/otp-unlock.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class OtpUnlock < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "otp-unlock-form") do
13
+ safe_html rodauth.otp_unlock_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ p { "#{rodauth.otp_unlock_consecutive_successes_label}: #{rodauth.otp_unlock_num_successes}" }
16
+ p { "#{rodauth.otp_unlock_required_consecutive_successes_label}: #{rodauth.otp_unlock_auths_required}" }
17
+ p { "#{rodauth.otp_unlock_next_auth_deadline_label}: #{rodauth.otp_unlock_deadline.strftime(rodauth.strftime_format)}" }
18
+ OtpAuthCodeField(rodauth)
19
+ Button(rodauth, rodauth.otp_unlock_button)
20
+ end
21
+ plain rodauth.otp_unlock_form_footer
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/otp-unlock-not-available.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class OtpUnlockNotAvailable < Rodauth::View
11
+ def view_template
12
+ p { "#{rodauth.otp_unlock_consecutive_successes_label}: #{rodauth.otp_unlock_num_successes}" }
13
+ p { "#{rodauth.otp_unlock_required_consecutive_successes_label}: #{rodauth.otp_unlock_auths_required}" }
14
+ p { "#{rodauth.otp_unlock_next_auth_attempt_label}: #{otp_unlock_next_auth_attempt_after}" }
15
+ p { rodauth.otp_unlock_next_auth_attempt_refresh_label }
16
+ safe_html rodauth.otp_unlock_refresh_tag
17
+ end
18
+
19
+ def otp_unlock_next_auth_attempt_after
20
+ rodauth.otp_unlock_next_auth_attempt_after.strftime(rodauth.strftime_format)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/recovery-auth.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class RecoveryAuth < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "recovery-auth-form") do
13
+ safe_html rodauth.recovery_auth_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ div(class: "form-group mb-3") do
16
+ label(for: "recovery-code", class: "form-label") { "#{rodauth.recovery_codes_label}#{rodauth.input_field_label_suffix}" }
17
+ InputField(rodauth, rodauth.recovery_codes_param, "recovery-code", value: "", autocomplete: "off")
18
+ end
19
+ Button(rodauth, rodauth.recovery_auth_button)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/remember.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class Remember < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "remember-form") do
13
+ safe_html rodauth.remember_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ fieldset(class: "form-group mb-3") do
16
+ div(class: "form-check radio") do
17
+ input(type: "radio", name: rodauth.remember_param, id: "remember-remember", value: rodauth.remember_remember_param_value, class: "form-check-input")
18
+ label(class: "form-check-label", for: "remember-remember") { rodauth.remember_remember_label }
19
+ end
20
+ div(class: "form-check radio") do
21
+ input(type: "radio", name: rodauth.remember_param, id: "remember-forget", value: rodauth.remember_forget_param_value, class: "form-check-input")
22
+ label(class: "form-check-label", for: "remember-forget") { rodauth.remember_forget_label }
23
+ end
24
+ div(class: "form-check radio") do
25
+ input(type: "radio", name: rodauth.remember_param, id: "remember-disable", value: rodauth.remember_disable_param_value, class: "form-check-input")
26
+ label(class: "form-check-label", for: "remember-disable") { rodauth.remember_disable_label }
27
+ end
28
+ end
29
+ Button(rodauth, rodauth.remember_button)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/reset-password.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class ResetPassword < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "reset-password-form") do
13
+ safe_html rodauth.reset_password_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth)
16
+ PasswordConfirmField(rodauth) if rodauth.require_password_confirmation?
17
+ Button(rodauth, rodauth.reset_password_button)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/reset-password-request.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class ResetPasswordRequest < Rodauth::View
11
+ def view_template
12
+ form(action: rodauth.reset_password_request_path, method: "post", class: "rodauth", role: "form", id: "reset-password-request-form") do
13
+ safe_html rodauth.reset_password_request_additional_form_tags
14
+ safe_html rodauth.csrf_tag(rodauth.reset_password_request_path)
15
+ safe_html rodauth.reset_password_explanatory_text
16
+ if rodauth.param_or_nil(rodauth.login_param) && !rodauth.field_error(rodauth.login_param)
17
+ LoginHiddenField(rodauth)
18
+ else
19
+ LoginField(rodauth)
20
+ end
21
+ Button(rodauth, rodauth.reset_password_request_button)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/sms-auth.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class SmsAuth < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "sms-auth-form") do
13
+ safe_html rodauth.sms_auth_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ SmsCodeField(rodauth)
16
+ Button(rodauth, rodauth.sms_auth_button)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/sms-confirm.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class SmsConfirm < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "sms-confirm-form") do
13
+ safe_html rodauth.sms_confirm_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ SmsCodeField(rodauth)
16
+ Button(rodauth, rodauth.sms_confirm_button)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/sms-disable.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class SmsDisable < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "sms-disable-form") do
13
+ safe_html rodauth.sms_disable_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth) if rodauth.two_factor_modifications_require_password?
16
+ Button(rodauth, rodauth.sms_disable_button)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/sms-request.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class SmsRequest < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "sms-request-form") do
13
+ safe_html rodauth.sms_request_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ Button(rodauth, rodauth.sms_request_button)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/sms-setup.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class SmsSetup < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "sms-setup-form") do
13
+ safe_html rodauth.sms_setup_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth) if rodauth.two_factor_modifications_require_password?
16
+
17
+ div(class: "form-group mb-3") do
18
+ label(for: "sms-phone", class: "form-label") { "#{rodauth.sms_phone_label}#{rodauth.input_field_label_suffix}" }
19
+ div(class: "row") do
20
+ div(class: "col-sm-3") do
21
+ InputField(rodauth, rodauth.sms_phone_param, "sms-phone", type: rodauth.sms_phone_input_type, autocomplete: "tel")
22
+ end
23
+ end
24
+ end
25
+
26
+ Button(rodauth, rodauth.sms_setup_button)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/two-factor-auth.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class TwoFactorAuth < Rodauth::View
11
+ def view_template
12
+ ul(class: "rodauth-links rodauth-two-factor-auth-links") do
13
+ rodauth.two_factor_auth_links.each do |_, link, text|
14
+ li { a(href: link) { text } }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/two-factor-disable.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class TwoFactorDisable < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "multifactor-disable-form") do
13
+ safe_html rodauth.two_factor_disable_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth) if rodauth.two_factor_modifications_require_password?
16
+ Button(rodauth, rodauth.two_factor_disable_button)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/two-factor-manage.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class TwoFactorManage < Rodauth::View
11
+ def view_template
12
+ safe_html rodauth.two_factor_setup_heading unless rodauth.two_factor_setup_links.empty?
13
+ ul(class: "rodauth-links rodauth-multifactor-setup-links") do
14
+ rodauth.two_factor_setup_links.each do |_, link, text|
15
+ li { a(href: link) { text } }
16
+ end
17
+ end
18
+
19
+ safe_html rodauth.two_factor_remove_heading unless rodauth.two_factor_remove_links.empty?
20
+ ul(class: "rodauth-links rodauth-multifactor-remove-links") do
21
+ rodauth.two_factor_remove_links.each do |_, link, text|
22
+ li { a(href: link) { text } }
23
+ end
24
+ li { a(href: rodauth.two_factor_disable_path) { rodauth.two_factor_disable_link_text } } if rodauth.two_factor_remove_links.length > 1
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/unlock-account.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class UnlockAccount < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "unlock-account-form") do
13
+ safe_html rodauth.unlock_account_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ safe_html rodauth.unlock_account_explanatory_text
16
+ PasswordField(rodauth) if rodauth.unlock_account_requires_password?
17
+ Button(rodauth, rodauth.unlock_account_button)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/unlock-account-request.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class UnlockAccountRequest < Rodauth::View
11
+ def view_template
12
+ form(action: rodauth.unlock_account_request_path, method: "post", class: "rodauth", role: "form", id: "unlock-account-request-form") do
13
+ safe_html rodauth.unlock_account_request_additional_form_tags
14
+ safe_html rodauth.csrf_tag(rodauth.unlock_account_request_path)
15
+ LoginHiddenField(rodauth)
16
+ safe_html rodauth.unlock_account_request_explanatory_text
17
+ Button(rodauth, rodauth.unlock_account_request_button)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/verify-account.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class VerifyAccount < Rodauth::View
11
+ def view_template
12
+ form(method: "post", class: "rodauth", role: "form", id: "verify-account-form") do
13
+ safe_html rodauth.verify_account_additional_form_tags
14
+ safe_html rodauth.csrf_tag
15
+ PasswordField(rodauth) if rodauth.verify_account_set_password?
16
+ PasswordConfirmField(rodauth) if rodauth.verify_account_set_password? && rodauth.require_password_confirmation?
17
+ Button(rodauth, rodauth.verify_account_button)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RodauthPhlex::Views
4
+ # This is a Phlex version of the Rodauth template:
5
+ # https://github.com/jeremyevans/rodauth/blob/2.37.0/templates/verify-account-resend.str
6
+ #
7
+ # Copyright (c) 2024 Robert Schulze
8
+ # Copyright (c) 2015-2023 Jeremy Evans
9
+ # MIT License
10
+ class VerifyAccountResend < Rodauth::View
11
+ def view_template
12
+ form(action: "rodauth.verify_account_resend_path", method: "post", class: "rodauth", role: "form", id: "verify-account-resend-form") do
13
+ safe_html rodauth.verify_account_resend_additional_form_tags
14
+ safe_html rodauth.csrf_tag(rodauth.verify_account_resend_path)
15
+ safe_html rodauth.verify_account_resend_explanatory_text
16
+ if rodauth.param_or_nil(rodauth.login_param)
17
+ LoginHiddenField(rodauth)
18
+ else
19
+ LoginField(rodauth)
20
+ end
21
+ Button(rodauth, rodauth.verify_account_resend_button)
22
+ end
23
+ end
24
+ end
25
+ end