Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/mailers/identity_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def v2_login_code(login_code)
@login_code = login_code
@identity = login_code.identity
@first_name = @identity.first_name
@code = login_code.pretty
@code = login_code.code
@env_prefix = env_prefix
@preview_text = "Your code is #{@code}"

Expand Down
2 changes: 0 additions & 2 deletions app/models/identity/v2_login_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def self.generate(identity, purpose: "login", **attrs)
create!(identity:, purpose:, **attrs)
end

def pretty = code&.scan(/.../)&.join("-")

private

def generate_code
Expand Down
2 changes: 1 addition & 1 deletion app/views/identity_mailer/v2_login_code.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p class="body-text"><%= t(".body") %></p>

<div class="code-block"><%= @code %></div>
<div class="code-block"><span class="code"><% @code.scan(/.{1,3}/).each do |group| %><span class="code-group"><%= group %></span><% end %></span></div>
<p class="hint"><%= t(".triple_click") %></p>

<p class="secondary-text"><%= t(".expiry") %></p>
Expand Down
11 changes: 11 additions & 0 deletions app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@
box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}

.code-block .code {
display: inline-block;
-webkit-user-select: all;
user-select: all;
margin-right: -0.25em;
}

.code-block .code-group + .code-group {
margin-left: 0.6em;
}

.reason-block {
background-color: #fef9e7;
border-left: 3px solid #d97706;
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ en:
subject: "%{code} is your Hack Club login code"
greeting: "Hey %{first_name}!"
body: "Here's the code to sign into your Hack Club Account:"
triple_click: "(triple-click to copy it quicker!)"
triple_click: "(click to copy it quicker!)"
expiry: "This code expires in 30 minutes."
not_you: "Didn't request this? You can safely ignore this email."
signature: "– Hack Club"
Expand Down
Loading