Spaces:
Sleeping
Sleeping
Add message unotherizdexception
Browse files
backend/src/modules/authentication/authentication.service.ts
CHANGED
@@ -23,10 +23,10 @@ export class AuthenticationService {
|
|
23 |
else
|
24 |
user = await this.usersService.findOneByField('phone_number', username);
|
25 |
if (!user)
|
26 |
-
throw new UnauthorizedException();
|
27 |
const compare = await bcrypt.compare(pass, user.hash_password)
|
28 |
if (!compare) {
|
29 |
-
throw new UnauthorizedException();
|
30 |
}
|
31 |
const payload = { sub: user.id, username: user.full_name, roles: user.role};
|
32 |
return {
|
|
|
23 |
else
|
24 |
user = await this.usersService.findOneByField('phone_number', username);
|
25 |
if (!user)
|
26 |
+
throw new UnauthorizedException("We can't find your user");
|
27 |
const compare = await bcrypt.compare(pass, user.hash_password)
|
28 |
if (!compare) {
|
29 |
+
throw new UnauthorizedException("Wrong password");
|
30 |
}
|
31 |
const payload = { sub: user.id, username: user.full_name, roles: user.role};
|
32 |
return {
|