Can I customize the passwordless link email subject with the time the link expires?
-
Can I customize the passwordless link email subject with the time the link expires?
Pulled over from https://github.com/FusionAuth/fusionauth-issues/issues/735
-
You can put this in the
Default subject
section of the Passwordless email template:[#setting time_zone = (user.timezone)!"NZ/Auckland"] [#setting time_format = "h:mm a"] Expires at: ${((.now?date?long + timeToLive * 1000)?number_to_time)?string}
You need to make sure that each user has a valid timezone, and you'll need to sync the
timeToLive
value with the passwordless login time to live in seconds tenant setting, until https://github.com/FusionAuth/fusionauth-issues/issues/612 is done. -
@dan FusionAuth seems to determine the user's timezone during account creation, registration, and login but doesn't update the user.timezone value with this new info.
Using the FusionAuth login screens the passwordless form calls /oauth2/passwordless?client_id=3....&timezone=Australia%2FSydney but doesn't result in an update to the user.timezone and isn't available to the email template.
Are there any good solutions to this? The user's current actual tz is probably more useful than a potentially stale or null timezone in the profile - certainly in this use case of providing an accurate expiration time for the passwordless link. I don't see an event that can alert us to passwordless requests.
-
Hi David,
It sounds like you're looking for a way to pass the timezone of the user into the passwordless call so it is available in the email template. I agree that the current timezone is more useful than the possibly stale value in the user profile.
I don't know of any way to do this currently. So my suggestion would be to file a feature request: https://github.com/fusionauth/fusionauth-issues