@progalaxyelabs/ngx-stonescriptphp-client 1.23.0 → 1.23.2

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.
@@ -2443,7 +2443,7 @@ class TenantLoginComponent {
2443
2443
  // Normalize: auto-prepend +91 for 10-digit Indian numbers
2444
2444
  if (type === 'phone') {
2445
2445
  const digits = raw.replace(/\D/g, '');
2446
- this.otpNormalizedIdentifier = digits.length === 10 ? `+91${digits}` : (raw.startsWith('+') ? raw : `+${digits}`);
2446
+ this.otpNormalizedIdentifier = digits.length === 10 ? `+91${digits}` : `+${digits}`;
2447
2447
  }
2448
2448
  else {
2449
2449
  this.otpNormalizedIdentifier = raw;
@@ -2472,6 +2472,8 @@ class TenantLoginComponent {
2472
2472
  }
2473
2473
  /** Verify the entered OTP code */
2474
2474
  async onOtpVerify() {
2475
+ if (this.loading)
2476
+ return;
2475
2477
  const code = this.otpCode;
2476
2478
  if (code.length < 6) {
2477
2479
  this.error = 'Please enter the complete 6-digit code';
@@ -2520,6 +2522,14 @@ class TenantLoginComponent {
2520
2522
  try {
2521
2523
  const result = await this.auth.identityRegister(this.otpVerifiedToken, name);
2522
2524
  if (!result.success) {
2525
+ // If token expired, restart OTP flow
2526
+ if (result.message?.includes('expired') || result.message?.includes('Invalid')) {
2527
+ this.error = 'Session expired. Please verify again.';
2528
+ this.otpStep = 'identifier';
2529
+ this.otpVerifiedToken = '';
2530
+ this.otpDisplayName = '';
2531
+ return;
2532
+ }
2523
2533
  this.error = result.message || 'Registration failed';
2524
2534
  return;
2525
2535
  }
@@ -2849,15 +2859,15 @@ class TenantLoginComponent {
2849
2859
  </button>
2850
2860
  }
2851
2861
  </div>
2862
+ }
2852
2863
 
2853
- <!-- Switch to Email/Password -->
2854
- @if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0) {
2855
- <div class="switch-method">
2856
- <a href="#" (click)="toggleAuthMethod($event)">
2857
- {{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
2858
- </a>
2859
- </div>
2860
- }
2864
+ <!-- Switch between OAuth and Email/Password -->
2865
+ @if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0 && !otpActive) {
2866
+ <div class="switch-method">
2867
+ <a href="#" (click)="toggleAuthMethod($event)">
2868
+ {{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
2869
+ </a>
2870
+ </div>
2861
2871
  }
2862
2872
 
2863
2873
  <!-- Error Message -->
@@ -3130,15 +3140,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
3130
3140
  </button>
3131
3141
  }
3132
3142
  </div>
3143
+ }
3133
3144
 
3134
- <!-- Switch to Email/Password -->
3135
- @if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0) {
3136
- <div class="switch-method">
3137
- <a href="#" (click)="toggleAuthMethod($event)">
3138
- {{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
3139
- </a>
3140
- </div>
3141
- }
3145
+ <!-- Switch between OAuth and Email/Password -->
3146
+ @if (isProviderEnabled('emailPassword') && effectiveOauthProviders.length > 0 && !otpActive) {
3147
+ <div class="switch-method">
3148
+ <a href="#" (click)="toggleAuthMethod($event)">
3149
+ {{ useOAuth ? 'Use email/password instead' : 'Use OAuth instead' }}
3150
+ </a>
3151
+ </div>
3142
3152
  }
3143
3153
 
3144
3154
  <!-- Error Message -->