tango-app-ui-auth 3.4.0-beta.1 → 3.5.0-beta.1

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.
@@ -223,6 +223,7 @@ class TangoAuthLoginComponent {
223
223
  });
224
224
  this.isloader = false;
225
225
  }
226
+ loginAttemptCount = 0;
226
227
  onLogin(resend) {
227
228
  // localStorage.clear();
228
229
  this.hasError = false;
@@ -234,6 +235,7 @@ class TangoAuthLoginComponent {
234
235
  if (resend) {
235
236
  delete this.credentials['otp'];
236
237
  }
238
+ // this.credentials.password = crypto.AES.encrypt( this.credentials.password,'fc7154e0' ).toString();
237
239
  this.service.login(this.credentials).pipe(takeUntil(this.destroy$)).subscribe({
238
240
  next: (res) => {
239
241
  if (res && res?.code === 200) {
@@ -278,12 +280,22 @@ class TangoAuthLoginComponent {
278
280
  this.toastService.getErrorToast('Invalid OTP');
279
281
  }
280
282
  else {
281
- let errorMessage = err?.error?.message || err?.error?.error || err?.message || 'Something went wrong';
282
- this.toastService.getErrorToast(errorMessage);
283
+ this.handleLoginError(err);
283
284
  }
284
285
  },
285
286
  });
286
287
  }
288
+ handleLoginError(err) {
289
+ this.loginAttemptCount++;
290
+ if (this.loginAttemptCount >= 5) {
291
+ this.toastService.getErrorToast('Please try again later. You are allowed a maximum of 5 attempts.');
292
+ this.router.navigate(['/auth/forgot-password']);
293
+ }
294
+ else {
295
+ const errorMessage = err?.error?.message || err?.error?.error || err?.message || 'Enter Valid Credentials';
296
+ this.toastService.getErrorToast(errorMessage);
297
+ }
298
+ }
287
299
  userProfile() {
288
300
  this.service.userProfileDet().pipe(takeUntil(this.destroy$)).subscribe({
289
301
  next: (res) => {