@progalaxyelabs/ngx-stonescriptphp-client 1.23.1 → 1.23.3
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.
|
@@ -1169,13 +1169,15 @@ class AuthService {
|
|
|
1169
1169
|
plugin;
|
|
1170
1170
|
tokens;
|
|
1171
1171
|
signinStatus;
|
|
1172
|
+
environment;
|
|
1172
1173
|
USER_STORAGE_KEY = 'progalaxyapi_user';
|
|
1173
1174
|
userSubject = new BehaviorSubject(null);
|
|
1174
1175
|
user$ = this.userSubject.asObservable();
|
|
1175
|
-
constructor(plugin, tokens, signinStatus) {
|
|
1176
|
+
constructor(plugin, tokens, signinStatus, environment) {
|
|
1176
1177
|
this.plugin = plugin;
|
|
1177
1178
|
this.tokens = tokens;
|
|
1178
1179
|
this.signinStatus = signinStatus;
|
|
1180
|
+
this.environment = environment;
|
|
1179
1181
|
this.restoreUser();
|
|
1180
1182
|
}
|
|
1181
1183
|
// ── State management ──────────────────────────────────────────────────────
|
|
@@ -1301,6 +1303,40 @@ class AuthService {
|
|
|
1301
1303
|
isAuthenticated() {
|
|
1302
1304
|
return this.tokens.hasValidAccessToken();
|
|
1303
1305
|
}
|
|
1306
|
+
// ── Profile management ────────────────────────────────────────────────────
|
|
1307
|
+
/**
|
|
1308
|
+
* Update the authenticated user's display name.
|
|
1309
|
+
* Calls PUT /api/account/profile with { display_name } and updates local user state on success.
|
|
1310
|
+
*/
|
|
1311
|
+
async updateProfile(displayName) {
|
|
1312
|
+
const accessToken = this.tokens.getAccessToken();
|
|
1313
|
+
if (!accessToken) {
|
|
1314
|
+
return { success: false, message: 'Not authenticated' };
|
|
1315
|
+
}
|
|
1316
|
+
try {
|
|
1317
|
+
const host = this.environment.apiServer.host;
|
|
1318
|
+
const response = await fetch(`${host}/api/account/profile`, {
|
|
1319
|
+
method: 'PUT',
|
|
1320
|
+
headers: {
|
|
1321
|
+
'Content-Type': 'application/json',
|
|
1322
|
+
'Authorization': `Bearer ${accessToken}`
|
|
1323
|
+
},
|
|
1324
|
+
body: JSON.stringify({ display_name: displayName })
|
|
1325
|
+
});
|
|
1326
|
+
const data = await response.json();
|
|
1327
|
+
if (data.status === 'ok') {
|
|
1328
|
+
const currentUser = this.getCurrentUser();
|
|
1329
|
+
if (currentUser) {
|
|
1330
|
+
this.updateUser({ ...currentUser, display_name: displayName });
|
|
1331
|
+
}
|
|
1332
|
+
return { success: true };
|
|
1333
|
+
}
|
|
1334
|
+
return { success: false, message: data.message || 'Profile update failed' };
|
|
1335
|
+
}
|
|
1336
|
+
catch {
|
|
1337
|
+
return { success: false, message: 'Network error. Please try again.' };
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1304
1340
|
getCurrentUser() {
|
|
1305
1341
|
return this.userSubject.value;
|
|
1306
1342
|
}
|
|
@@ -1415,7 +1451,7 @@ class AuthService {
|
|
|
1415
1451
|
const result = await this.plugin.checkEmail(email);
|
|
1416
1452
|
return result.exists ? result.user : null;
|
|
1417
1453
|
}
|
|
1418
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, deps: [{ token: AUTH_PLUGIN }, { token: TokenService }, { token: SigninStatusService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1454
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, deps: [{ token: AUTH_PLUGIN }, { token: TokenService }, { token: SigninStatusService }, { token: MyEnvironmentModel }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1419
1455
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
1420
1456
|
}
|
|
1421
1457
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, decorators: [{
|
|
@@ -1426,7 +1462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
1426
1462
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1427
1463
|
type: Inject,
|
|
1428
1464
|
args: [AUTH_PLUGIN]
|
|
1429
|
-
}] }, { type: TokenService }, { type: SigninStatusService }] });
|
|
1465
|
+
}] }, { type: TokenService }, { type: SigninStatusService }, { type: MyEnvironmentModel }] });
|
|
1430
1466
|
|
|
1431
1467
|
class ApiConnectionService {
|
|
1432
1468
|
tokens;
|
|
@@ -2859,15 +2895,15 @@ class TenantLoginComponent {
|
|
|
2859
2895
|
</button>
|
|
2860
2896
|
}
|
|
2861
2897
|
</div>
|
|
2898
|
+
}
|
|
2862
2899
|
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
}
|
|
2900
|
+
<!-- Switch between OAuth and Email/Password -->
|
|
2901
|
+
@if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0 && !otpActive) {
|
|
2902
|
+
<div class="switch-method">
|
|
2903
|
+
<a href="#" (click)="toggleAuthMethod($event)">
|
|
2904
|
+
{{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
|
|
2905
|
+
</a>
|
|
2906
|
+
</div>
|
|
2871
2907
|
}
|
|
2872
2908
|
|
|
2873
2909
|
<!-- Error Message -->
|
|
@@ -3140,15 +3176,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
3140
3176
|
</button>
|
|
3141
3177
|
}
|
|
3142
3178
|
</div>
|
|
3179
|
+
}
|
|
3143
3180
|
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
}
|
|
3181
|
+
<!-- Switch between OAuth and Email/Password -->
|
|
3182
|
+
@if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0 && !otpActive) {
|
|
3183
|
+
<div class="switch-method">
|
|
3184
|
+
<a href="#" (click)="toggleAuthMethod($event)">
|
|
3185
|
+
{{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
|
|
3186
|
+
</a>
|
|
3187
|
+
</div>
|
|
3152
3188
|
}
|
|
3153
3189
|
|
|
3154
3190
|
<!-- Error Message -->
|