rez_core 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -18,11 +18,12 @@ export class LoginController {
18
18
  constructor(private loginService: LoginService) {}
19
19
 
20
20
  @Post('login')
21
+
21
22
  async login(@Body() body, @Res() res: Response) {
22
- console.log("hey")
23
23
  return res
24
24
  .status(HttpStatus.OK)
25
25
  .json(await this.loginService.login(body.email_id, body.password));
26
+
26
27
  }
27
28
 
28
29
  @UseGuards(JwtAuthGuard)
@@ -18,7 +18,13 @@ export class LoginService {
18
18
  async login(email: string, password: string) {
19
19
  console.log(process.env.master_key)
20
20
  const user = await this.userService.findByEmailId(email);
21
- if (!user) throw new BadRequestException('Your Email ID not registered.');
21
+ if (!user) {
22
+ return {
23
+ success: false,
24
+ message: 'Your Email ID not registered.',
25
+ type: 'email',
26
+ };
27
+ }
22
28
 
23
29
  const encryptedPassword = EncryptUtilService.encryptGCM(
24
30
  password,
@@ -27,7 +33,11 @@ export class LoginService {
27
33
  );
28
34
 
29
35
  if (encryptedPassword !== user.password) {
30
- throw new BadRequestException('Oops! Your password is incorrect.');
36
+ return {
37
+ success: false,
38
+ message: 'Oops! Your password is incorrect.',
39
+ type: 'password',
40
+ };
31
41
  }
32
42
 
33
43
  return this.userSessionService.createSession(user);