rez_core 2.2.205 → 2.2.208

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": "2.2.205",
3
+ "version": "2.2.208",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -114,9 +114,38 @@ export class LoginController {
114
114
  actualState,
115
115
  );
116
116
 
117
- return res.redirect(`${this.configService.get('BASE_URL')}`);
117
+ return res.redirect(`
118
+ <html>
119
+ <body>
120
+ <script>
121
+ // Notify parent window that OAuth succeeded
122
+ if (window.opener) {
123
+ window.opener.postMessage({ type: 'CONFIG_SUCCESS' }, '*');
124
+ }
125
+ // Close the popup window
126
+ window.close();
127
+ </script>
128
+ <p>Configuration successful. You can close this window.</p>
129
+ </body>
130
+ </html>
131
+ `);
118
132
  } catch (error) {
119
- return res.redirect(`${this.configService.get('BASE_URL')}`);
133
+ return res.redirect(`
134
+ <html>
135
+ <body>
136
+ <script>
137
+ if (window.opener) {
138
+ window.opener.postMessage({
139
+ type: "CONFIG_FAILED",
140
+ error: "${error.message || 'Something went wrong'}"
141
+ }, "*");
142
+ }
143
+ window.close();
144
+ </script>
145
+ <p>Configuration failed. Please close this window.</p>
146
+ </body>
147
+ </html>
148
+ `);
120
149
  }
121
150
  }
122
151
 
@@ -136,6 +165,12 @@ export class LoginController {
136
165
  );
137
166
 
138
167
  const { accessToken, appcode } = data;
168
+ if (data.slug) {
169
+ return res.redirect(
170
+ `https://${data.slug}.${this.configService.get('DOMAIN_URL')}/auth?token=${accessToken}&appcode=${appcode}`,
171
+ );
172
+ }
173
+
139
174
  return res.redirect(
140
175
  `${this.configService.get('BASE_URL')}/auth?token=${accessToken}&appcode=${appcode}`,
141
176
  );
@@ -180,12 +180,24 @@ export class LoginService {
180
180
  }
181
181
 
182
182
  // 🔹 Step 8: Return response
183
+
184
+ const org = await this.organizationRepository.findOrganizationById(
185
+ user.organization_id,
186
+ );
187
+ let slug: string;
188
+ if (org) {
189
+ slug = org.subdomain;
190
+ } else {
191
+ throw new BadRequestException();
192
+ }
193
+
183
194
  return {
184
195
  success: true,
185
196
  accessToken: token,
186
197
  appcode: defaultAccess.appcode,
187
198
  level_type: defaultAccess.level_type,
188
199
  level_id: defaultAccess.level_id,
200
+ slug: slug,
189
201
  };
190
202
  }
191
203
 
@@ -11,6 +11,7 @@ CLIENT_ID: '819281384645-2tnuvm80sul1n2ahqa4eg6kjd19pnbu9.apps.googleusercontent
11
11
  CLIENT_SECRET: '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'
12
12
  CALLBACK_URL: 'http://localhost:5001/auth/google/callback'
13
13
  BASE_URL: 'http://localhost:5001'
14
+ DOMAIN_URL: 'rezolut.in'
14
15
  OTP_EXPIRY: '10'
15
16
  OTP_LENGTH: '6'
16
17
  VERIFY_OTP: 'false'