Developer forum

Forum » Swift » Password recovery link

Password recovery link

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

In GitHub I see this recent change:

https://github.com/dynamicweb/Swift/blob/main/Swift/Files/Templates/Designs/Swift/UserManagement/Login/RecoveryEmail.cshtml#L10-L11

which adds the full scheme and domain to the URL in the password reset template. Yet in the code for the module I see this:

private void SendPasswordRecoveryLink(User user, int linkLifeTime)
{
    string token = Guid.NewGuid().ToString();
    user.PasswordRecoveryToken = token;
    user.PasswordRecoveryTokenExpirationTime = DateTime.UtcNow.AddHours(linkLifeTime);
    user.Save();
    string url = $"{Context.Current.Request.Url.Scheme}://{Context.Current.Request.Url.Host}/Default.aspx?ID={Context.Current.Request.QueryString["ID"]}&RecoveryToken={user.PasswordRecoveryToken}";

    Dictionary<string, string> tagsValues = new Dictionary<string, string>
    {
        { "DWPasswordRecoveryUrl", url },
        { "DWPasswordRecoveryToken", token },
        { "DWPasswordRecoveryMethod", PasswordRecoveryMethod.SendRestoreLink.ToString() }
    };

You would think that would add the domain twice, no? But at the same time, it seems that we don't get the URL in the template if I simply use GetString("DWPasswordRecoveryUrl") (although I have also cases where it does work)

What am I missing? Did this get changed in the core product recently?

Imar


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Yup - that is a mistake.

It was fixed in Dynamicweb core on the 22nd and in Swift template on the 24th.

The DW fix is the right one as that link broke when we added page based system emails.

I will ask someone to roll back the Swift one.

BR Nicolai

 

You must be logged in to post in the forum