supaapps-auth 2.0.0-rc.8 → 2.0.0-rc.9

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.
@@ -18,6 +18,7 @@ export declare class AuthManager {
18
18
  getLoginWithGoogleUri(): string;
19
19
  isLoggedIn(): Promise<boolean>;
20
20
  getAccessToken(mustBeLoggedIn?: boolean): Promise<string>;
21
+ platformCheck(email: string, token: string): Promise<boolean>;
21
22
  verifyEmail(email: string, token: string): Promise<boolean>;
22
23
  doPassReset(email: string, token: string, newPassword: string): Promise<boolean>;
23
24
  changeEmail(email: string): Promise<boolean>;
@@ -139,6 +139,18 @@ class AuthManager {
139
139
  }
140
140
  });
141
141
  }
142
+ platformCheck(email, token) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ const response = yield axios_1.default.post(`${this.authServer}auth/email/platform_check`, {
145
+ realm_name: this.realmName,
146
+ email,
147
+ });
148
+ if (response.data.error || response.data.errors) {
149
+ throw new Error(response.data.error || response.data.message);
150
+ }
151
+ return (response.status === 200) ? response.data : { 'platforms': [] };
152
+ });
153
+ }
142
154
  verifyEmail(email, token) {
143
155
  return __awaiter(this, void 0, void 0, function* () {
144
156
  const response = yield axios_1.default.post(`${this.authServer}auth/email/verify`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supaapps-auth",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.0-rc.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -170,6 +170,22 @@ export class AuthManager {
170
170
  }
171
171
  }
172
172
 
173
+
174
+ public async platformCheck(email: string, token: string): Promise<boolean> {
175
+ const response = await axios.post(
176
+ `${this.authServer}auth/email/platform_check`,
177
+ {
178
+ realm_name: this.realmName,
179
+ email,
180
+ },
181
+ );
182
+ if (response.data.error || response.data.errors) {
183
+ throw new Error(response.data.error || response.data.message);
184
+ }
185
+
186
+ return (response.status === 200) ? response.data : {'platforms': []};
187
+ }
188
+
173
189
  public async verifyEmail(email: string, token: string): Promise<boolean> {
174
190
  const response = await axios.post(
175
191
  `${this.authServer}auth/email/verify`,