184a827965
When the auth-related controllers hit rate limits they set an alert in the flash. But we weren't displaying the flash on the public layout, so those were never seen. Changed to surface the alert. But also change the "Try another code" message to be shake-only instead, to match the current behaviour.
28 lines
1.3 KiB
Plaintext
28 lines
1.3 KiB
Plaintext
<% @page_title = "Check your email" %>
|
|
|
|
<div class="panel panel--centered flex flex-column gap-half <%= "shake" if flash[:alert] || flash[:shake] %>">
|
|
<header>
|
|
<h1 class="txt-x-large font-weight-black margin-none"><%= @page_title %></h1>
|
|
<p class="margin-none-block-start txt-medium">Then enter the verification code included in the email below:</p>
|
|
</header>
|
|
|
|
<%= form_with url: session_magic_link_path, method: :post, html: { data: { controller: "magic-link" } } do |form| %>
|
|
<%= form.text_field :code, required: true, class: "input center txt-align-enter txt-large",
|
|
autofocus: true, autocorrect: "off", autocapitalize: "off", spellcheck: "false", "data-1p-ignore": true,
|
|
autocomplete: "one-time-code", maxlength: "6", placeholder: "••••••", value: params[:code],
|
|
data: { magic_link_target: "input", action: "keydown.enter->magic-link#submit paste->magic-link#submit" } %>
|
|
<% end %>
|
|
|
|
<p class="txt-small">The code you receive will work for <%= distance_of_time_in_words(MagicLink::EXPIRATION_TIME) %>.</p>
|
|
</div>
|
|
|
|
<% if Rails.env.development? %>
|
|
<script>
|
|
console.log("Magic link code: <%= flash[:magic_link_code].presence || "not generated" %>");
|
|
</script>
|
|
<% end %>
|
|
|
|
<% content_for :footer do %>
|
|
<%= render "sessions/footer" %>
|
|
<% end %>
|