rails_authentication 0.6.0 → 0.8.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -10
  3. data/lib/generators/authentication/authentication_generator.rb +135 -8
  4. data/lib/generators/authentication/features/confirmable.rb +5 -5
  5. data/lib/generators/authentication/features/invitable.rb +5 -5
  6. data/lib/generators/authentication/features/lockable.rb +5 -5
  7. data/lib/generators/authentication/features/magic_link.rb +5 -5
  8. data/lib/generators/authentication/features/ott.rb +5 -5
  9. data/lib/generators/authentication/features/recoverable.rb +8 -6
  10. data/lib/generators/authentication/features/rememberable.rb +8 -3
  11. data/lib/generators/authentication/templates/app/controllers/concerns/authentication.rb.tt +67 -15
  12. data/lib/generators/authentication/templates/app/controllers/confirmations_controller.rb.tt +11 -7
  13. data/lib/generators/authentication/templates/app/controllers/invitations_controller.rb.tt +14 -5
  14. data/lib/generators/authentication/templates/app/controllers/magic_links_controller.rb.tt +10 -8
  15. data/lib/generators/authentication/templates/app/controllers/otts_controller.rb.tt +18 -15
  16. data/lib/generators/authentication/templates/app/controllers/passkey_sessions_controller.rb.tt +9 -7
  17. data/lib/generators/authentication/templates/app/controllers/passwords_controller.rb.tt +22 -9
  18. data/lib/generators/authentication/templates/app/controllers/registrations_controller.rb.tt +8 -6
  19. data/lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt +11 -9
  20. data/lib/generators/authentication/templates/app/controllers/unlocks_controller.rb.tt +8 -6
  21. data/lib/generators/authentication/templates/app/controllers/webauthn_credentials_controller.rb.tt +8 -4
  22. data/lib/generators/authentication/templates/app/mailers/confirmations_mailer.rb.tt +4 -2
  23. data/lib/generators/authentication/templates/app/mailers/invitations_mailer.rb.tt +3 -1
  24. data/lib/generators/authentication/templates/app/mailers/magic_links_mailer.rb.tt +3 -1
  25. data/lib/generators/authentication/templates/app/mailers/otts_mailer.rb.tt +3 -1
  26. data/lib/generators/authentication/templates/app/mailers/passwords_mailer.rb.tt +3 -1
  27. data/lib/generators/authentication/templates/app/mailers/unlocks_mailer.rb.tt +3 -1
  28. data/lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt +16 -11
  29. data/lib/generators/authentication/templates/app/models/concerns/invitable_concern.rb.tt +13 -2
  30. data/lib/generators/authentication/templates/app/models/concerns/lockable_concern.rb.tt +8 -0
  31. data/lib/generators/authentication/templates/app/models/concerns/magic_link_concern.rb.tt +2 -0
  32. data/lib/generators/authentication/templates/app/models/concerns/ott_concern.rb.tt +2 -0
  33. data/lib/generators/authentication/templates/app/models/concerns/passkey_concern.rb.tt +2 -0
  34. data/lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt +8 -0
  35. data/lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt +2 -0
  36. data/lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt +2 -0
  37. data/lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt +6 -4
  38. data/lib/generators/authentication/templates/app/models/session.rb.tt +45 -0
  39. data/lib/generators/authentication/templates/app/models/user_auth.rb.tt +5 -3
  40. data/lib/generators/authentication/templates/app/models/webauthn_credential.rb.tt +2 -0
  41. data/lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt +3 -3
  42. data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.html.erb.tt +3 -3
  43. data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.text.erb.tt +2 -2
  44. data/lib/generators/authentication/templates/app/views/invitations/edit.html.erb.tt +4 -4
  45. data/lib/generators/authentication/templates/app/views/invitations/new.html.erb.tt +3 -3
  46. data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.html.erb.tt +3 -3
  47. data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.text.erb.tt +2 -2
  48. data/lib/generators/authentication/templates/app/views/magic_links/new.html.erb.tt +4 -4
  49. data/lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.html.erb.tt +3 -3
  50. data/lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.text.erb.tt +2 -3
  51. data/lib/generators/authentication/templates/app/views/otts/edit.html.erb.tt +7 -7
  52. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.html.erb.tt +3 -3
  53. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.text.erb.tt +3 -3
  54. data/lib/generators/authentication/templates/app/views/passwords/edit.html.erb.tt +9 -0
  55. data/lib/generators/authentication/templates/app/views/passwords/new.html.erb.tt +8 -0
  56. data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +3 -3
  57. data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +2 -2
  58. data/lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt +7 -7
  59. data/lib/generators/authentication/templates/app/views/registrations/new.html.erb.tt +6 -6
  60. data/lib/generators/authentication/templates/app/views/sessions/new.html.erb.tt +20 -16
  61. data/lib/generators/authentication/templates/app/views/unlocks/new.html.erb.tt +3 -3
  62. data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.html.erb.tt +3 -3
  63. data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.text.erb.tt +3 -3
  64. data/lib/generators/authentication/templates/app/views/webauthn_credentials/index.html.erb.tt +5 -5
  65. data/lib/generators/authentication/templates/app/views/webauthn_credentials/new.html.erb.tt +12 -6
  66. data/lib/generators/authentication/templates/config/initializers/webauthn.rb.tt +2 -0
  67. data/lib/generators/authentication/templates/config/locales/authentication.en.yml.tt +421 -0
  68. data/lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt +1 -1
  69. data/lib/generators/authentication/templates/db/migrate/add_rememberable_to_sessions.rb.tt +5 -0
  70. data/lib/generators/authentication/templates/db/migrate/remove_remember_created_at_from_users.rb.tt +11 -0
  71. data/lib/rails_authentication/version.rb +1 -1
  72. metadata +8 -3
  73. data/lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt +0 -15
  74. data/lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt +0 -5
@@ -1,4 +1,4 @@
1
- <h1>Your account</h1>
1
+ <h1><%%= t('.heading') %></h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
  <%%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %>
@@ -12,15 +12,15 @@
12
12
  <%% end %>
13
13
 
14
14
  <%%= form_with url: registration_path, method: :patch do |form| %>
15
- <%%= form.email_field :email_address, required: true, autocomplete: "username", value: @user.email_address %><br>
16
- <%%= form.password_field :password, autocomplete: "new-password", placeholder: "New password (leave blank to keep current)", maxlength: 72 %><br>
17
- <%%= form.password_field :password_confirmation, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %><br>
18
- <%%= form.submit "Update" %>
15
+ <%%= form.email_field authentication_email_column_name, required: true, autocomplete: "username", value: @user[authentication_email_column_name] %><br>
16
+ <%%= form.password_field :password, autocomplete: "new-password", placeholder: t('.form.input.password.placeholder'), maxlength: <%= password_maxlength %> %><br>
17
+ <%%= form.password_field :password_confirmation, autocomplete: "new-password", placeholder: t('.form.input.password_confirmation.placeholder'), maxlength: <%= password_maxlength %> %><br>
18
+ <%%= form.submit t('.form.button.submit') %>
19
19
  <%% end %>
20
20
  <br>
21
21
 
22
22
  <% if passkey? -%>
23
- <%%= link_to "Manage your passkeys", webauthn_credentials_path %>
23
+ <%%= link_to t('.links.passkeys'), webauthn_credentials_path %>
24
24
  <br><br>
25
25
  <% end -%>
26
- <%%= button_to "Delete my account", registration_path, method: :delete, data: { turbo_confirm: "Are you sure?" } %>
26
+ <%%= button_to t('.links.delete'), registration_path, method: :delete, data: { turbo_confirm: t('.confirmation.delete') } %>
@@ -1,4 +1,4 @@
1
- <h1>Sign up</h1>
1
+ <h1><%%= t('.heading') %></h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
 
@@ -11,11 +11,11 @@
11
11
  <%% end %>
12
12
 
13
13
  <%%= form_with url: registration_path do |form| %>
14
- <%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: @user.email_address %><br>
15
- <%%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter a password", maxlength: 72 %><br>
16
- <%%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat the password", maxlength: 72 %><br>
17
- <%%= form.submit "Sign up" %>
14
+ <%%= form.email_field authentication_email_column_name, required: true, autofocus: true, autocomplete: "username", placeholder: t('.form.input.email.placeholder'), value: @user[authentication_email_column_name] %><br>
15
+ <%%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: t('.form.input.password.placeholder'), maxlength: <%= password_maxlength %> %><br>
16
+ <%%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: t('.form.input.password_confirmation.placeholder'), maxlength: <%= password_maxlength %> %><br>
17
+ <%%= form.submit t('.form.button.submit') %>
18
18
  <%% end %>
19
19
  <br>
20
20
 
21
- <%%= link_to "Sign in", new_session_path %>
21
+ <%%= link_to t('.links.sign_in'), new_session_path %>
@@ -4,34 +4,34 @@
4
4
  <% if ott? -%>
5
5
  <%% if params[:with_password].blank? %>
6
6
  <%%= form_with url: ott_path do |form| %>
7
- <%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %><br>
8
- <%%= form.submit "Email me a sign-in code" %>
7
+ <%%= form.email_field authentication_email_column_name, required: true, autofocus: true, autocomplete: "username", placeholder: t('.ott.form.input.email.placeholder'), value: params[authentication_email_column_name] %><br>
8
+ <%%= form.submit t('.ott.form.button.submit') %>
9
9
  <%% end %>
10
10
  <br>
11
11
 
12
- <br><%%= link_to "Sign in with password instead", new_session_path(with_password: 1) %>
12
+ <br><%%= link_to t('.links.session'), new_session_path(with_password: 1) %>
13
13
  <%% else %>
14
14
  <% end -%>
15
15
  <%%= form_with url: session_path do |form| %>
16
- <%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %><br>
17
- <%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %><br>
16
+ <%%= form.email_field authentication_email_column_name, required: true, autofocus: true, autocomplete: "username", placeholder: t('.session.form.input.email.placeholder'), value: params[authentication_email_column_name] %><br>
17
+ <%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: t('.session.form.input.password.placeholder'), maxlength: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED %><br>
18
18
  <% if rememberable? -%>
19
- <%%= form.check_box :remember_me %> <%%= form.label :remember_me, "Remember me" %><br>
19
+ <%%= form.check_box :remember_me %> <%%= form.label :remember_me, t('.session.form.input.remember.label') %><br>
20
20
  <% end -%>
21
- <%%= form.submit "Sign in" %>
21
+ <%%= form.submit t('.session.form.button.submit') %>
22
22
  <%% end %>
23
23
  <br>
24
24
  <% if ott? -%>
25
25
 
26
- <br><%%= link_to "Sign in with a one-time code instead", new_session_path %>
26
+ <br><%%= link_to t('.links.ott'), new_session_path %>
27
27
  <%% end %>
28
28
  <% end -%>
29
29
 
30
30
  <% if magic_link? -%>
31
- <br><%%= link_to "Sign in with magic link", new_magic_link_path %>
31
+ <br><%%= link_to t('.links.magic_link'), new_magic_link_path %>
32
32
  <% end -%>
33
33
  <% if passkey? -%>
34
- <br><%%= button_tag "Sign in with a passkey", type: "button", id: "passkey-sign-in-button" %>
34
+ <br><%%= button_tag t('.links.passkey'), type: "button", id: "passkey-sign-in-button" %>
35
35
  <%%= tag.span "", id: "passkey-sign-in-error", style: "color:red" %>
36
36
 
37
37
  <%%= javascript_tag do %>
@@ -62,7 +62,11 @@
62
62
  try {
63
63
  credential = await navigator.credentials.get({ publicKey: options });
64
64
  } catch (error) {
65
- document.getElementById("passkey-sign-in-error").textContent = error.message;
65
+ // The browser's own message is technical, so show a translated one and log the original.
66
+ console.error(error);
67
+ document.getElementById("passkey-sign-in-error").textContent = error.name === "NotAllowedError"
68
+ ? "<%%= j t('.error.cancelled') %>"
69
+ : "<%%= j t('.error.passkey') %>";
66
70
  return;
67
71
  }
68
72
 
@@ -89,19 +93,19 @@
89
93
  if (response.ok) {
90
94
  window.location.href = result.redirect_to;
91
95
  } else {
92
- document.getElementById("passkey-sign-in-error").textContent = result.error || "Could not sign in with passkey.";
96
+ document.getElementById("passkey-sign-in-error").textContent = result.error || "<%%= j t('.error.passkey') %>";
93
97
  }
94
98
  });
95
99
  })();
96
100
  <%% end %>
97
101
  <% end -%>
98
- <br><%%= link_to "Forgot password?", new_password_path %>
102
+ <br><%%= link_to t('.links.forgot_password'), new_password_path %>
99
103
  <% if registerable? -%>
100
- <br><%%= link_to "Sign up", new_registration_path %>
104
+ <br><%%= link_to t('.links.sign_up'), new_registration_path %>
101
105
  <% end -%>
102
106
  <% if confirmable? -%>
103
- <br><%%= link_to "Resend confirmation instructions", new_confirmation_path %>
107
+ <br><%%= link_to t('.links.resend_confirmation'), new_confirmation_path %>
104
108
  <% end -%>
105
109
  <% if lockable? -%>
106
- <br><%%= link_to "Resend unlock instructions", new_unlock_path %>
110
+ <br><%%= link_to t('.links.resend_unlock'), new_unlock_path %>
107
111
  <% end -%>
@@ -1,8 +1,8 @@
1
- <h1>Resend unlock instructions</h1>
1
+ <h1><%%= t('.heading') %></h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
 
5
5
  <%%= form_with url: unlocks_path do |form| %>
6
- <%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %><br>
7
- <%%= form.submit "Resend unlock instructions" %>
6
+ <%%= form.email_field authentication_email_column_name, required: true, autofocus: true, autocomplete: "username", placeholder: t('.form.input.email.placeholder'), value: params[authentication_email_column_name] %><br>
7
+ <%%= form.submit t('.form.button.submit') %>
8
8
  <%% end %>
@@ -1,6 +1,6 @@
1
1
  <p>
2
- Your account has been locked due to too many failed sign-in attempts.
2
+ <%%= t('.attempts') %>
3
3
 
4
- You can unlock it now on <%%= link_to "this unlock page", unlock_url(@user.unlock_token) %>,
5
- or wait <%%= distance_of_time_in_words(0, LockableConcern::UNLOCK_IN) %> for the lock to expire on its own.
4
+ <%%= t('.unlock_on') %> <%%= link_to t('.unlock_page'), unlock_url(@user.unlock_token) %>,
5
+ <%%= t('.or_wait', ttl: distance_of_time_in_words(0, LockableConcern::UNLOCK_IN)) %>
6
6
  </p>
@@ -1,6 +1,6 @@
1
- Your account has been locked due to too many failed sign-in attempts.
1
+ <%%= t('.attempts') %>
2
2
 
3
- You can unlock it now on
3
+ <%%= t('.unlock_on') %>
4
4
  <%%= unlock_url(@user.unlock_token) %>
5
5
 
6
- or wait <%%= distance_of_time_in_words(0, LockableConcern::UNLOCK_IN) %> for the lock to expire on its own.
6
+ <%%= t('.or_wait', ttl: distance_of_time_in_words(0, LockableConcern::UNLOCK_IN)) %>
@@ -1,19 +1,19 @@
1
- <h1>Your passkeys</h1>
1
+ <h1><%%= t('.heading') %></h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
  <%%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %>
5
5
 
6
6
  <%% if @webauthn_credentials.empty? %>
7
- <p>You haven't added a passkey yet.</p>
7
+ <p><%%= t('.none') %></p>
8
8
  <%% else %>
9
9
  <ul>
10
10
  <%% @webauthn_credentials.each do |credential| %>
11
11
  <li>
12
- <%%= credential.nickname %> &mdash; added <%%= credential.created_at.to_date %>
13
- <%%= button_to "Remove", webauthn_credential_path(credential), method: :delete, data: { turbo_confirm: "Remove this passkey?" } %>
12
+ <%%= t('.account_added', nickname: credential.nickname, date_added: credential.created_at.to_date) %>
13
+ <%%= button_to t('.buttons.remove'), webauthn_credential_path(credential), method: :delete, data: { turbo_confirm: t('.confirmations.remove') } %>
14
14
  </li>
15
15
  <%% end %>
16
16
  </ul>
17
17
  <%% end %>
18
18
 
19
- <br><%%= link_to "Add a passkey", new_webauthn_credential_path %>
19
+ <br><%%= link_to t('.links.add'), new_webauthn_credential_path %>
@@ -1,12 +1,12 @@
1
- <h1>Add a passkey</h1>
1
+ <h1><%%= t('.heading') %></h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
  <%%= tag.span "", id: "passkey-error", style: "color:red" %>
5
5
 
6
- <%%= label_tag :passkey_nickname, "Name this passkey (e.g. \"MacBook\" or \"iPhone\")" %>
7
- <%%= text_field_tag :passkey_nickname, nil, placeholder: "Passkey" %><br><br>
6
+ <%%= label_tag :passkey_nickname, t('.form.input.nickname.label') %>
7
+ <%%= text_field_tag :passkey_nickname, nil, placeholder: t('.form.input.nickname.placeholder') %><br><br>
8
8
 
9
- <%%= button_tag "Create passkey", type: "button", id: "create-passkey-button" %>
9
+ <%%= button_tag t('.form.button.submit'), type: "button", id: "create-passkey-button" %>
10
10
 
11
11
  <%%= javascript_tag do %>
12
12
  (function () {
@@ -38,7 +38,13 @@
38
38
  try {
39
39
  credential = await navigator.credentials.create({ publicKey: options });
40
40
  } catch (error) {
41
- document.getElementById("passkey-error").textContent = error.message;
41
+ // The browser's own message is technical, so show a translated one and log the original.
42
+ console.error(error);
43
+ const messages = {
44
+ InvalidStateError: "<%%= j t('.error.already_registered') %>",
45
+ NotAllowedError: "<%%= j t('.error.cancelled') %>"
46
+ };
47
+ document.getElementById("passkey-error").textContent = messages[error.name] || "<%%= j t('.error.save') %>";
42
48
  return;
43
49
  }
44
50
 
@@ -64,7 +70,7 @@
64
70
  if (response.ok) {
65
71
  window.location.href = result.redirect_to;
66
72
  } else {
67
- document.getElementById("passkey-error").textContent = result.error || "Could not save passkey.";
73
+ document.getElementById("passkey-error").textContent = result.error || "<%%= j t('.error.save') %>";
68
74
  }
69
75
  });
70
76
  })();
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  WebAuthn.configure do |config|
2
4
  # This value needs to match `window.location.hostname` where the API is called from in
3
5
  # your client-side (front-end) code.
@@ -0,0 +1,421 @@
1
+ ---
2
+ en:
3
+ <% if validatable? -%>
4
+ activerecord:
5
+ errors:
6
+ models:
7
+ user:
8
+ attributes:
9
+ password:
10
+ complexity: must meet password complexity standards
11
+ <% end -%>
12
+ <% if confirmable? -%>
13
+ confirmations:
14
+ new:
15
+ form:
16
+ button:
17
+ submit: Resend confirmation instructions
18
+ input:
19
+ email:
20
+ placeholder: Enter your email address
21
+ heading: Resend confirmation instructions
22
+ <% end -%>
23
+ <% if confirmable? -%>
24
+ confirmations_mailer:
25
+ confirmation_instructions:
26
+ confirm_on: You can confirm your email address on
27
+ confirmation_page: this confirmation page
28
+ expire_in: This link will expire in %{ttl}.
29
+ subject: Confirm your email address
30
+ <% end -%>
31
+ flash:
32
+ authentication:
33
+ alert:
34
+ already_signed_in: You are already signed in.
35
+ <% if confirmable? -%>
36
+ confirmations:
37
+ create:
38
+ alert:
39
+ rate_limited: Try again later.
40
+ notice: Confirmation instructions sent (if user with that email address exists and is unconfirmed).
41
+ show:
42
+ alert:
43
+ invalid_token: Confirmation link is invalid or has expired.
44
+ notice: Your email address has been confirmed. Please sign in.
45
+ <% end -%>
46
+ <% if invitable? -%>
47
+ invitations:
48
+ create:
49
+ notice: Invitation sent to %{email}.
50
+ edit:
51
+ alert:
52
+ invalid_token: Invitation link is invalid or has expired.
53
+ update:
54
+ alert:
55
+ invalid_token: Invitation link is invalid or has expired.
56
+ notice: Welcome! Your account is ready.
57
+ <% end -%>
58
+ <% if magic_link? -%>
59
+ magic_links:
60
+ create:
61
+ alert:
62
+ rate_limited: Try again later.
63
+ notice: Sign-in link sent (if a user with that email address exists).
64
+ show:
65
+ alert:
66
+ invalid_token: Sign-in link is invalid or has expired.
67
+ <% if invitable? -%>
68
+ invitation_pending: You must accept your invitation before signing in.
69
+ <% end -%>
70
+ <% if lockable? -%>
71
+ locked: Your account is locked. Check your email for unlock instructions.
72
+ <% end -%>
73
+ <% if confirmable? -%>
74
+ unconfirmed: You must confirm your email address before signing in.
75
+ <% end -%>
76
+ <% end -%>
77
+ <% if ott? -%>
78
+ otts:
79
+ create:
80
+ alert:
81
+ rate_limited: Try again later.
82
+ notice: We've emailed you a sign-in code (if a user with that email address exists).
83
+ update:
84
+ alert:
85
+ incorrect_code: Incorrect code. Try again.
86
+ invalid_code: Your sign-in code is invalid or has expired. Request a new one.
87
+ <% if invitable? -%>
88
+ invitation_pending: You must accept your invitation before signing in.
89
+ <% end -%>
90
+ <% if lockable? -%>
91
+ locked: Your account is locked. Check your email for unlock instructions.
92
+ <% end -%>
93
+ rate_limited: Try again later.
94
+ too_many_attempts: Too many incorrect attempts. Request a new code.
95
+ <% if confirmable? -%>
96
+ unconfirmed: You must confirm your email address before signing in.
97
+ <% end -%>
98
+ <% end -%>
99
+ <% if recoverable? -%>
100
+ passwords:
101
+ create:
102
+ alert:
103
+ rate_limited: Try again later.
104
+ notice: Password reset instructions sent (if user with that email address exists).
105
+ edit:
106
+ alert:
107
+ invalid_token: Password reset link is invalid or has expired.
108
+ update:
109
+ alert:
110
+ invalid_token: Password reset link is invalid or has expired.
111
+ password_blank: Enter a new password.
112
+ password_mismatch: Passwords did not match.
113
+ notice: Password has been reset.
114
+ <% end -%>
115
+ <% if registerable? -%>
116
+ registrations:
117
+ create:
118
+ <% if confirmable? -%>
119
+ notice: Welcome! Check your email to confirm your account.
120
+ <% else -%>
121
+ notice: Welcome! You have signed up successfully.
122
+ <% end -%>
123
+ destroy:
124
+ notice: Your account has been deleted.
125
+ update:
126
+ notice: Your account has been updated.
127
+ <% end -%>
128
+ sessions:
129
+ create:
130
+ alert:
131
+ invalid: Try another email address or password.
132
+ <% if invitable? -%>
133
+ invitation_pending: You must accept your invitation before signing in.
134
+ <% end -%>
135
+ <% if lockable? -%>
136
+ locked: Your account is locked. Check your email for unlock instructions.
137
+ <% end -%>
138
+ rate_limited: Try again later.
139
+ <% if confirmable? -%>
140
+ unconfirmed: You must confirm your email address before signing in.
141
+ <% end -%>
142
+ destroy:
143
+ notice: You have been signed out.
144
+ <% if lockable? -%>
145
+ unlocks:
146
+ create:
147
+ alert:
148
+ rate_limited: Try again later.
149
+ notice: Unlock instructions sent (if user with that email address exists and is locked).
150
+ show:
151
+ alert:
152
+ invalid_token: Unlock link is invalid or has expired.
153
+ notice: Your account has been unlocked. Please sign in.
154
+ <% end -%>
155
+ <% if passkey? -%>
156
+ webauthn_credentials:
157
+ destroy:
158
+ notice: Passkey removed.
159
+ <% end -%>
160
+ <% if invitable? -%>
161
+ invitations:
162
+ edit:
163
+ form:
164
+ button:
165
+ submit: Set my password
166
+ input:
167
+ password:
168
+ placeholder: Choose a password
169
+ password_confirmation:
170
+ placeholder: Repeat the password
171
+ heading: Accept your invitation
172
+ new:
173
+ form:
174
+ button:
175
+ submit: Send invitation
176
+ input:
177
+ email:
178
+ placeholder: Enter your email address
179
+ heading: Invite someone
180
+ <% end -%>
181
+ <% if invitable? -%>
182
+ invitations_mailer:
183
+ invitation_instructions:
184
+ activate_on: You have been invited. Set your password and activate your account on
185
+ expire_in: This link will expire in %{ttl}.
186
+ invitation_page: this invitation page
187
+ subject: You have been invited
188
+ <% end -%>
189
+ <% if passkey? -%>
190
+ json:
191
+ passkey_sessions:
192
+ create:
193
+ alert:
194
+ <% if invitable? -%>
195
+ invitation_pending: You must accept your invitation before signing in.
196
+ <% end -%>
197
+ <% if lockable? -%>
198
+ locked: Your account is locked. Check your email for unlock instructions.
199
+ <% end -%>
200
+ not_recognized: Passkey not recognized.
201
+ rate_limited: Try again later.
202
+ <% if confirmable? -%>
203
+ unconfirmed: You must confirm your email address before signing in.
204
+ <% end -%>
205
+ verification_failed: Passkey verification failed.
206
+ webauthn_credentials:
207
+ create:
208
+ alert:
209
+ save_failed: Could not save passkey.
210
+ <% end -%>
211
+ <% if magic_link? -%>
212
+ magic_links:
213
+ new:
214
+ form:
215
+ button:
216
+ submit: Email me a sign-in link
217
+ input:
218
+ email:
219
+ placeholder: Enter your email address
220
+ heading: Sign in with magic link
221
+ links:
222
+ session: Sign in with password
223
+ <% end -%>
224
+ <% if magic_link? -%>
225
+ magic_links_mailer:
226
+ magic_link:
227
+ expire_in: This link will expire in %{ttl} and can only be used once.
228
+ magic_link_page: this sign-in link
229
+ sign_in_on: You can sign in to your account by following
230
+ subject: Your sign-in link
231
+ <% end -%>
232
+ <% if ott? -%>
233
+ otts:
234
+ edit:
235
+ buttons:
236
+ resend: Resend code
237
+ emailed_code_to: We emailed a %{digit_count}-digit code to %{email}.
238
+ expires_in: It expires in %{expires_in}.
239
+ form:
240
+ button:
241
+ submit: Sign in
242
+ input:
243
+ digit:
244
+ aria: Digit %{digit}
245
+ <% if rememberable? -%>
246
+ remember:
247
+ label: Remember me
248
+ <% end -%>
249
+ heading: Enter your sign-in code
250
+ <% end -%>
251
+ <% if ott? -%>
252
+ otts_mailer:
253
+ ott:
254
+ expire_in: This code will expire in %{ttl} and can only be used once.
255
+ ignore: If you didn't request it, you can ignore this email.
256
+ sign_in_code: 'Your sign-in code is:'
257
+ subject: Your sign-in code
258
+ <% end -%>
259
+ <% if recoverable? -%>
260
+ passwords:
261
+ edit:
262
+ form:
263
+ button:
264
+ submit: Save
265
+ input:
266
+ password:
267
+ placeholder: Enter new password
268
+ password_confirmation:
269
+ placeholder: Repeat new password
270
+ heading: Update your password
271
+ new:
272
+ form:
273
+ button:
274
+ submit: Email reset instructions
275
+ input:
276
+ email:
277
+ placeholder: Enter your email address
278
+ heading: Forgot your password?
279
+ <% end -%>
280
+ <% if recoverable? -%>
281
+ passwords_mailer:
282
+ reset:
283
+ expire_in: This link will expire in %{ttl}.
284
+ reset_on: You can reset your password on
285
+ reset_page: this password reset page
286
+ subject: Reset your password
287
+ <% end -%>
288
+ <% if registerable? -%>
289
+ registrations:
290
+ edit:
291
+ confirmation:
292
+ delete: Are you sure?
293
+ form:
294
+ button:
295
+ submit: Update
296
+ input:
297
+ password:
298
+ placeholder: New password (leave blank to keep current)
299
+ password_confirmation:
300
+ placeholder: Repeat new password
301
+ heading: Your account
302
+ links:
303
+ delete: Delete my account
304
+ <% if passkey? -%>
305
+ passkeys: Manage your passkeys
306
+ <% end -%>
307
+ new:
308
+ form:
309
+ button:
310
+ submit: Sign up
311
+ input:
312
+ email:
313
+ placeholder: Enter your email address
314
+ password:
315
+ placeholder: Enter a password
316
+ password_confirmation:
317
+ placeholder: Repeat the password
318
+ heading: Sign up
319
+ links:
320
+ sign_in: Sign in
321
+ <% end -%>
322
+ sessions:
323
+ new:
324
+ <% if passkey? -%>
325
+ error:
326
+ cancelled: Passkey sign-in was cancelled or timed out.
327
+ passkey: Could not sign in with passkey.
328
+ <% end -%>
329
+ links:
330
+ forgot_password: Forgot password?
331
+ <% if magic_link? -%>
332
+ magic_link: Sign in with magic link
333
+ <% end -%>
334
+ <% if ott? -%>
335
+ ott: Sign in with a one-time code instead
336
+ <% end -%>
337
+ <% if passkey? -%>
338
+ passkey: Sign in with a passkey
339
+ <% end -%>
340
+ <% if confirmable? -%>
341
+ resend_confirmation: Resend confirmation instructions
342
+ <% end -%>
343
+ <% if lockable? -%>
344
+ resend_unlock: Resend unlock instructions
345
+ <% end -%>
346
+ <% if ott? -%>
347
+ session: Sign in with password instead
348
+ <% end -%>
349
+ <% if registerable? -%>
350
+ sign_up: Sign up
351
+ <% end -%>
352
+ <% if ott? -%>
353
+ ott:
354
+ form:
355
+ button:
356
+ submit: Email me a sign-in code
357
+ input:
358
+ email:
359
+ placeholder: Enter your email address
360
+ <% end -%>
361
+ session:
362
+ form:
363
+ button:
364
+ submit: Sign in
365
+ input:
366
+ email:
367
+ placeholder: Enter your email address
368
+ password:
369
+ placeholder: Enter your password
370
+ <% if rememberable? -%>
371
+ remember:
372
+ label: Remember me
373
+ <% end -%>
374
+ <% if lockable? -%>
375
+ unlocks:
376
+ new:
377
+ form:
378
+ button:
379
+ submit: Resend unlock instructions
380
+ input:
381
+ email:
382
+ placeholder: Enter your email address
383
+ heading: Resend unlock instructions
384
+ <% end -%>
385
+ <% if lockable? -%>
386
+ unlocks_mailer:
387
+ unlock_instructions:
388
+ attempts: Your account has been locked due to too many failed sign-in attempts.
389
+ or_wait: or wait %{ttl} for the lock to expire on its own.
390
+ subject: Unlock your account
391
+ unlock_on: You can unlock it now on
392
+ unlock_page: this unlock page
393
+ <% end -%>
394
+ <% if passkey? -%>
395
+ webauthn_credentials:
396
+ create:
397
+ default_nickname: Passkey
398
+ index:
399
+ account_added: "%{nickname} - added %{date_added}"
400
+ buttons:
401
+ remove: Remove
402
+ confirmations:
403
+ remove: Remove this passkey?
404
+ heading: Your passkeys
405
+ links:
406
+ add: Add a passkey
407
+ none: You haven't added a passkey yet.
408
+ new:
409
+ error:
410
+ already_registered: This device already has a passkey for your account.
411
+ cancelled: Passkey creation was cancelled or timed out.
412
+ save: Could not save passkey.
413
+ form:
414
+ button:
415
+ submit: Create passkey
416
+ input:
417
+ nickname:
418
+ label: Name this passkey (e.g. MacBook or iPhone)
419
+ placeholder: Passkey
420
+ heading: Add a passkey
421
+ <% end -%>
@@ -4,7 +4,7 @@ class AddConfirmableToUsers < ActiveRecord::Migration<%= migration_version %>
4
4
  add_column :users, :confirmed_at, :datetime
5
5
  add_column :users, :confirmation_sent_at, :datetime
6
6
  <% if reconfirmable? -%>
7
- add_column :users, :unconfirmed_email, :string
7
+ add_column :users, :<%= unconfirmed_email_attribute %>, :string
8
8
  <% end -%>
9
9
 
10
10
  add_index :users, :confirmation_token, unique: true