MCPcopy Index your code
hub / github.com/TomDoesTech/REST-API-Tutorial / validatePassword

Function validatePassword

src/service/user.service.ts:17–37  ·  view source on GitHub ↗
({
  email,
  password,
}: {
  email: UserDocument["email"];
  password: string;
})

Source from the content-addressed store, hash-verified

15}
16
17export async function validatePassword({
18 email,
19 password,
20}: {
21 email: UserDocument["email"];
22 password: string;
23}) {
24 const user = await User.findOne({ email });
25
26 if (!user) {
27 return false;
28 }
29
30 const isValid = await user.comparePassword(password);
31
32 if (!isValid) {
33 return false;
34 }
35
36 return omit(user.toJSON(), "password");
37}

Callers 1

createUserSessionHandlerFunction · 0.90

Calls 1

comparePasswordMethod · 0.80

Tested by

no test coverage detected