From ca8b259cdb989d2d01aa02ff1fd31b57c1e3c8c5 Mon Sep 17 00:00:00 2001 From: Rob Sterner Date: Tue, 31 Dec 2024 15:59:58 -0500 Subject: [PATCH 1/2] improved sign in email formatting --- app/views/layouts/mailer.html.erb | 54 ++++++++++++++---- .../passwordless/mailer/sign_in.html.erb | 57 +++++++++++++++++++ .../passwordless/mailer/sign_in.text.erb | 8 ++- config/locales/passwordless.yml | 5 ++ 4 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 app/views/passwordless/mailer/sign_in.html.erb create mode 100644 config/locales/passwordless.yml diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 3aac9002..9e486bff 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,13 +1,45 @@ - - - - - - - - <%= yield %> - + + + + + + + + + + + + + + + <%= yield %> diff --git a/app/views/passwordless/mailer/sign_in.html.erb b/app/views/passwordless/mailer/sign_in.html.erb new file mode 100644 index 00000000..f5a11c5c --- /dev/null +++ b/app/views/passwordless/mailer/sign_in.html.erb @@ -0,0 +1,57 @@ + +
+
+ + + + +
+
+ + + + +
+ + StaffPlan + +
+

+ Hello there! +

+

+ Please use this token to complete your sign in to your StaffPlan account: +

+

+ <%= @token %> +

+

+ or sign in directly using the link below. +

+ +
+

+ Thanks, +
+ StaffPlan +

+
+ + + + +
+

+ © <%= Date.today.year %> StaffPlan. All rights reserved. +

+
+
+
+
+ diff --git a/app/views/passwordless/mailer/sign_in.text.erb b/app/views/passwordless/mailer/sign_in.text.erb index e5d78504..599bb6e9 100644 --- a/app/views/passwordless/mailer/sign_in.text.erb +++ b/app/views/passwordless/mailer/sign_in.text.erb @@ -1 +1,7 @@ -<%= t("passwordless.mailer.sign_in.body", token: @token, magic_link: @magic_link) %> +Use this token to complete your sign in: + +<%= @token %> + +Alternatively you can use this link to sign in directly: <%= @magic_link %> + +StaffPlan diff --git a/config/locales/passwordless.yml b/config/locales/passwordless.yml new file mode 100644 index 00000000..9115453c --- /dev/null +++ b/config/locales/passwordless.yml @@ -0,0 +1,5 @@ +en: + passwordless: + mailer: + sign_in: + subject: Sign in token for StaffPlan From d6dbf7a6f2e1ae5ef62bd2f42fa8428fe1f29e8e Mon Sep 17 00:00:00 2001 From: Rob Sterner Date: Tue, 31 Dec 2024 16:15:24 -0500 Subject: [PATCH 2/2] first pass at getting an iOS/MacOS prompt here --- app/views/passwordless/sessions/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/passwordless/sessions/show.html.erb b/app/views/passwordless/sessions/show.html.erb index 355e3ef5..bbebc55a 100644 --- a/app/views/passwordless/sessions/show.html.erb +++ b/app/views/passwordless/sessions/show.html.erb @@ -12,7 +12,10 @@
<%= f.label :token, "Please enter the token we've sent you via e-mail", autocomplete: "off", class: "block text-sm font-medium leading-6 text-gray-900" %>
- <%= f.text_field :token, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %> + <%= f.text_field :token, + class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6", + autocomplete: 'one-time-code' + %>