How can I hide the URL in my password reset email?
In my backend, this is how I have the URL setup:
accountService.js
async function sendPasswordResetEmail(account) {
let message;
const resetUrl = `https://www.example.com/accounts/reset-password?token=${account.resetToken.token}`;
message = `<p>Please click the below link to reset your password, the link will be valid for 1 day:</p>
<p><a href="${resetUrl}">${resetUrl}</a></p>`;
await sendEmail({
to: account.email,
subject: "Reset Password",
html: `<h4>Reset Password Email</h4>
${message}`,
});
}
When the email arrives to my inbox, the URL looks like this in the email:
https://www.example.com/accounts/reset-password?token=7a77f2273c599d2d49d1293bfb3b8a2a370528c6561189d6e229612eb51f1e0c219a3d92a20c8eda
I'd like to just show the user a link that says click here
How do I do this?
CodePudding user response:
Just don't interpolate the URL into the text of the <a>
?
<a href="${resetUrl}">Click Here</a>