Looking for some help from the javascript pros. Here’s my novice approach to the following situation:
I have card show/hide function on a login page. When the user clicks the PW reset button it shows a message telling them to go check their email for the reset link. I’d like another reset button to appear after 20 minutes in case the email doesn’t go through.
I’m have trouble figuring out how to attach a “timer” to this. Any insight is appreciated.
I have done something similar to this. If the purpose of this timer is to stop the user from clicking on the resend link button without first waiting for a certain time, then you can use a combination of date and time component and variable.
On the click event of the reset link, set a value for the variable end_timer.setValue(countdowntimer.datetime.addMinutes(20)).
Then disable the reset link button by adding this condition ((countdowntimer.datetime.minutesUntil(end_timer.value)).floor() > 0).
@brad has also made a valid point about the length of this wait.
Personally I think anything other than using a cookie is unlikely to help as any solution involving storage which would be cleared on leaving the page (such as variables), closing the browser (such as session variables) are unlikely to be as effective as desired.
Simply disable the link/button if the cookie is set
I’ve faced a lot of times this case…
I think the way I would go is:
The clicks the reset password button
a message apperas “Pleae check your email for the reset link…”
INSIDE this message I would insert at the bottom AND one more link
“You did’t receive the email with the link? Please click here to resend the link…”
I don’t know how you prefer to check the first link or the second and delete the according record in your database (a session I suppose) and proceed the reste procedure with the correct link (record in your database).
This way the system assumes that the email has been sent and received from the user UNLESS a new request tells the opposite
Thanks everyone - based on all the feedback and my novice level - a cookie wasn’t even considered. Headed on a little bit of travel for 10 days and will get back to it. Something to pour over during the flights…