rez_core 4.0.197 → 4.0.199
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/dist/module/linked_attributes/entity/linked_attribute.entity.d.ts +1 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js +4 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.d.ts +1 -31
- package/dist/module/notification/service/otp.service.d.ts +1 -31
- package/dist/module/notification/service/otp.service.js +1 -0
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +2 -1
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +3 -57
- package/dist/module/user/service/login.service.js +12 -2
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/linked_attributes/entity/linked_attribute.entity.ts +3 -0
- package/src/module/notification/service/otp.service.ts +1 -0
- package/src/module/user/controller/login.controller.ts +2 -1
- package/src/module/user/service/login.service.ts +25 -3
package/package.json
CHANGED
|
@@ -28,12 +28,13 @@ export class LoginController {
|
|
|
28
28
|
|
|
29
29
|
@Post('login')
|
|
30
30
|
async login(@Body() body, @Res() res: Response) {
|
|
31
|
-
const { email_id, password } = body;
|
|
31
|
+
const { email_id, password, subdomain } = body;
|
|
32
32
|
|
|
33
33
|
const result = await this.loginService.login({
|
|
34
34
|
email_id,
|
|
35
35
|
password,
|
|
36
36
|
is_otp: false, // default since you had it before
|
|
37
|
+
subdomain,
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
return res.status(HttpStatus.OK).json(result);
|
|
@@ -38,13 +38,35 @@ export class LoginService {
|
|
|
38
38
|
masterKey: string = this.configService.get('MASTER_KEY') || '';
|
|
39
39
|
masterIv: string = this.configService.get('MASTER_IV') || '';
|
|
40
40
|
|
|
41
|
-
async login(data: {
|
|
42
|
-
|
|
41
|
+
async login(data: {
|
|
42
|
+
email_id: string;
|
|
43
|
+
password?: string;
|
|
44
|
+
is_otp?: boolean;
|
|
45
|
+
subdomain?: string;
|
|
46
|
+
}): Promise<any> {
|
|
47
|
+
const { email_id, password, is_otp = false, subdomain } = data;
|
|
43
48
|
|
|
44
49
|
let organization;
|
|
45
50
|
|
|
51
|
+
if (subdomain) {
|
|
52
|
+
organization =
|
|
53
|
+
await this.organizationRepository.findOrganizationBySubdomain(
|
|
54
|
+
subdomain,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (!organization) {
|
|
58
|
+
return {
|
|
59
|
+
success: false,
|
|
60
|
+
message: 'Organization not found.',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
46
65
|
// 🔹 Step 2: Find the user by email + organization check
|
|
47
|
-
const user = await this.userService.findByEmailId(
|
|
66
|
+
const user = await this.userService.findByEmailId(
|
|
67
|
+
email_id,
|
|
68
|
+
organization?.id,
|
|
69
|
+
);
|
|
48
70
|
|
|
49
71
|
if (!user || (organization && user.organization_id !== organization.id)) {
|
|
50
72
|
return {
|