mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 15:24:54 +00:00
Merge pull request #74 from SyncrowIOT/SP-342-implement-region-end-point-in-the-login
added region to login
This commit is contained in:
@ -46,9 +46,17 @@ export class UserAuthService {
|
||||
);
|
||||
|
||||
try {
|
||||
const { regionUuid, ...rest } = userSignUpDto;
|
||||
const user = await this.userRepository.save({
|
||||
...userSignUpDto,
|
||||
...rest,
|
||||
password: hashedPassword,
|
||||
region: regionUuid
|
||||
? {
|
||||
uuid: regionUuid,
|
||||
}
|
||||
: {
|
||||
regionName: 'United Arab Emirates',
|
||||
},
|
||||
});
|
||||
|
||||
return user;
|
||||
@ -82,7 +90,11 @@ export class UserAuthService {
|
||||
}
|
||||
|
||||
async userLogin(data: UserLoginDto) {
|
||||
const user = await this.authService.validateUser(data.email, data.password);
|
||||
const user = await this.authService.validateUser(
|
||||
data.email,
|
||||
data.password,
|
||||
data.regionUuid,
|
||||
);
|
||||
|
||||
if (!user) {
|
||||
throw new UnauthorizedException('Invalid login credentials.');
|
||||
|
||||
Reference in New Issue
Block a user