FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Can I customize the passwordless link email subject with the time the link expires?

    Scheduled Pinned Locked Moved
    Q&A
    passwordless email subject
    2
    4
    2.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • danD
      dan
      last edited by

      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

      --
      FusionAuth - Auth for devs, built by devs.
      https://fusionauth.io

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        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.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        D 1 Reply Last reply Reply Quote 1
        • D
          davidmw @dan
          last edited by davidmw

          @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.

          1 Reply Last reply Reply Quote 0
          • danD
            dan
            last edited by dan

            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

            --
            FusionAuth - Auth for devs, built by devs.
            https://fusionauth.io

            1 Reply Last reply Reply Quote 0
            • First post
              Last post