Skip to content

Commit

Permalink
Follow best practices for the OTP login codes (#368)
Browse files Browse the repository at this point in the history
* Update login form to use best practice

* Update message to follow  the origin-bound one-time codes spec
  • Loading branch information
mveytsman authored May 23, 2024
1 parent 53dd34e commit 6105ca0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/bike_brigade/authentication_messenger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ defmodule BikeBrigade.AuthenticationMessenger do
msg = [
from: Messaging.outbound_number(),
to: phone,
body: "Your BikeBrigade access code is #{token}."
body: "Your BikeBrigade access code is #{token}.\n\n@#{BikeBrigadeWeb.Endpoint.host()} ##{token}"
]

SmsService.send_sms(msg)
Expand Down
15 changes: 13 additions & 2 deletions lib/bike_brigade_web/live/login_live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
</div>

<div class="text-center ">
<.button href="https://www.bikebrigade.ca/volunteer-rider-sign-up" color={:white} size={:small}>
<.button
href="https://www.bikebrigade.ca/volunteer-rider-sign-up"
color={:white}
size={:small}
>
Sign Up!
</.button>
</div>
Expand Down Expand Up @@ -65,7 +69,14 @@
</p>
</div>
<.input type="hidden" field={{f, :phone}} />
<.input type="text" field={{f, :token_attempt}} label="Authentication Code" />
<.input
type="text"
field={{f, :token_attempt}}
label="Authentication Code"
inputmode="numeric"
autocomplete="one-time-code"
pattern="\d{6}"
/>
<:actions>
<.button type="submit" class="w-full">Sign in</.button>
</:actions>
Expand Down

0 comments on commit 6105ca0

Please sign in to comment.