Skip to content

Instantly share code, notes, and snippets.

@rasikag
Created March 11, 2021 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rasikag/c6024f34e6fca2ad35da5ec790eb41db to your computer and use it in GitHub Desktop.
Save rasikag/c6024f34e6fca2ad35da5ec790eb41db to your computer and use it in GitHub Desktop.
@Mutation(() => Boolean)
async forgotPassword(
@Arg("email") email: string,
@Ctx() { em }: RedditDbContext
) {
const user = await em.findOne(User, {email});
if (!user) {
return true;
}
const token = "asdasdsadassadsadsadsadsad";
await sendEmail(email,
'<a href="http://localhost:3001/reset-password/${token}">click here to reset password</a>');
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment