Improve auth and seeds (#352)

* Improve seeds

* Autofill password on local environment

* Fix PR

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Félix Malfait
2023-06-21 23:47:24 -07:00
committed by GitHub
parent df6376dce0
commit 3c1851b3c9
6 changed files with 44 additions and 26 deletions

View File

@ -60,15 +60,15 @@ export class AuthService {
},
});
assert(user, "This user doens't exist", NotFoundException);
assert(user.passwordHash, 'Something wrong happened', ForbiddenException);
assert(user, "This user doesn't exist", NotFoundException);
assert(user.passwordHash, 'Incorrect login method', ForbiddenException);
const isValid = await compareHash(
challengeInput.password,
user.passwordHash,
);
assert(isValid, 'Something wrong happened', ForbiddenException);
assert(isValid, 'Wrong password', ForbiddenException);
return user;
}
@ -80,7 +80,7 @@ export class AuthService {
},
});
assert(data, "This user doens't exist", NotFoundException);
assert(data, "This user doesn't exist", NotFoundException);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { passwordHash: _, ...user } = data;