rez_core 1.0.17 → 1.0.19

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.17",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -5,6 +5,9 @@ import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service
5
5
 
6
6
  @Injectable()
7
7
  export class OtpService {
8
+ VERIFY_OTP = process.env.VERIFY_OTP || 'true';
9
+ DEFAULT_OTP = process.env.DEFAULT_OTP || '123456';
10
+
8
11
  constructor(
9
12
  private readonly otpRepository: OtpRepository,
10
13
  private readonly idGen: ClockIDGenService,
@@ -16,7 +19,7 @@ export class OtpService {
16
19
  otp.created_date = new Date();
17
20
  otp.otp_id = this.idGen.idGenerator();
18
21
  otp.identifier = identifier;
19
- otp.otp = this.generateOtp(otpLength);
22
+ otp.otp = 'true' === this.VERIFY_OTP ? this.generateOtp(otpLength) : this.DEFAULT_OTP;
20
23
  otp.service = service;
21
24
  otp.verified = 0;
22
25
  otp.expiration_date = new Date(Date.now() + expiresIn * 60 * 1000);
@@ -18,7 +18,7 @@ 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('Invalid email or password');
21
+ if (!user) throw new BadRequestException('Your Email ID not registered.');
22
22
 
23
23
  const encryptedPassword = EncryptUtilService.encryptGCM(
24
24
  password,
@@ -27,7 +27,7 @@ export class LoginService {
27
27
  );
28
28
 
29
29
  if (encryptedPassword !== user.password) {
30
- throw new BadRequestException('Invalid email or password');
30
+ throw new BadRequestException('Oops! Your password is incorrect.');
31
31
  }
32
32
 
33
33
  return this.userSessionService.createSession(user);
@@ -1,8 +1,5 @@
1
1
  import { BadRequestException, Injectable } from '@nestjs/common';
2
2
  import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
3
- import { EntityMasterService } from '../../meta/service/entity-master.service';
4
- import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
5
- import { LoggingService } from '../../../utils/service/loggingUtil.service';
6
3
  import { UserData } from '../entity/user.entity';
7
4
  import { BaseEntity } from '../../meta/entity/base-entity.entity';
8
5
  import { UserRepository } from '../repository/user.repository';
@@ -13,7 +10,6 @@ import { CreateUserDto } from '../dto/create-user.dto';
13
10
  import { UserRoleMappingService } from './user-role-mapping.service';
14
11
  import { UserRoleMapping } from '../entity/user-role-mapping.entity';
15
12
  import { plainToInstance } from 'class-transformer';
16
- import { EntityListService } from '../../meta/service/entity-list.service';
17
13
  import { EntityManager } from 'typeorm';
18
14
  import { UpdateUserDto } from '../dto/update-user.dto';
19
15
 
@@ -21,6 +17,7 @@ import { UpdateUserDto } from '../dto/update-user.dto';
21
17
  export class UserService extends EntityServiceImpl {
22
18
  masterKey = process.env.master_key || '';
23
19
  masterIv = process.env.master_iv || '';
20
+
24
21
  constructor(
25
22
  private userRepository: UserRepository,
26
23
  private userRoleMappingService: UserRoleMappingService,