-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow re-sending of magic link emails
When the config setting Passwordless.allow_token_resend = true a visit to /users/sign_in/TOKEN_URL for an expired or already claimed user will return a page with a button which can be used to resend an email with this token. Extra care is taken to record a query parameter `destination_path` into the current session, so opening the new email immediately from the same browser redirects you to the proper location.
- Loading branch information
Daan van Vugt
committed
Apr 14, 2023
1 parent
6ed4155
commit 1237a8b
Showing
5 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= form_with model: @session, method: :post, url: send(Passwordless.mounted_as).sign_in_path, data: { turbo: 'false' } do |f| %> | ||
<%= hidden_field_tag 'passwordless[destination_path]', @destination_path %> | ||
<%= hidden_field_tag 'passwordless[token]', @session.token %> | ||
<%= I18n.t('passwordless.sessions.show.explanation') %> | ||
<%= f.submit I18n.t('passwordless.sessions.show.submit') %> | ||
<% end %> | ||
<%= link_to I18n.t('passwordless.sessions.show.new'), send(Passwordless.mounted_as).sign_in_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ module Passwordless | |
mattr_accessor(:default_from_address) { "[email protected]" } | ||
mattr_accessor(:token_generator) { UrlSafeBase64Generator.new } | ||
mattr_accessor(:restrict_token_reuse) { false } | ||
mattr_accessor(:allow_token_resend) { false } | ||
mattr_accessor(:redirect_back_after_sign_in) { true } | ||
mattr_accessor(:mounted_as) { :configured_when_mounting_passwordless } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters