I am using java mail and activation to send email to the user. When user clicks forget password, a mail is to be triggered to user email with link for resetting the password.
I dont want user to use same link again, so when he clicks the link from email...the link should get disabled..
I am not sure how to do it...
String body = "<a href='resetpage.jsp'>Reset Password</a>";
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(username));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(email));
message.setSubject("Password Reset");
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText(body, "UTF-8", "html");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(mbp);
message.setContent(multipart);
Transport.send(message);
From this code, i am getting the link in email..but now after user click the link in email..the link should get disabled..or i want to make sure..when user clicks the same link again it should not work..
If I understand you correctly you would like to enable the user to click a link that will achieve some functionality and thereafter invalidate the link to ensure that it cannot be reused for performing another change.
What I would suggest is: