Hi, as far as I know the members section has no way of seeing when the link will expire. What you can do is when generating the code save this expiration time in a property.
var member = _memberService.GetByEmail(model.EmailAddress);
member.SetValue("tokenExpires", DateTime.UtcNow.AddHours(24));
_memberService.Save(member);
And when you reset the member's code, you can clear that date
var result = await _memberManager.ResetPasswordAsync(identityUser, resetCode, newPassword);
if (result.Succeeded)
{
var member = _memberService.GetByEmail(model.EmailAddress);
member.SetValue("tokenExpires", null);
_memberService.Save(member);
}
It is possible to do this better by injecting the DataProtectionTokenProviderOptions and setting the date according to what is configured and not as I described there, fixed 24 hours. But if you want to share more code context we can see how it looks
How to check if password link has expired
Hi
I'm creating a password link for a member listed under the member section in Umbraco 10.
According to the docs the link is valid for only 24 hours. How could I check if the link sent has expired?
Thanks
Hi, as far as I know the members section has no way of seeing when the link will expire. What you can do is when generating the code save this expiration time in a property.
And when you reset the member's code, you can clear that date
It is possible to do this better by injecting the DataProtectionTokenProviderOptions and setting the date according to what is configured and not as I described there, fixed 24 hours. But if you want to share more code context we can see how it looks
is working on a reply...