added error handling, fixed authenticaton, added toaster
This commit is contained in:
parent
40c35bda13
commit
b6b7cea210
18 changed files with 1327 additions and 68 deletions
|
|
@ -9,12 +9,12 @@ export async function LoginResolver(
|
|||
{ input }: MutationLoginArgs,
|
||||
{ identity }: IdentityContext
|
||||
): Promise<Session> {
|
||||
const error = 'Invalid username or password';
|
||||
const error = 'Invalid password or email';
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { email: input.email }
|
||||
});
|
||||
if (!user) throw new Error(error);
|
||||
if (user == null) throw new Error(error);
|
||||
|
||||
const match = await bcrypt.compare(input.password, user.password);
|
||||
if (!match) throw new Error(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue