...
|
...
|
@@ -43,6 +43,8 @@ import { DashboardInfo } from '@shared/models/dashboard.models'; |
43
|
43
|
import { PageData } from '@app/shared/models/page/page-data';
|
44
|
44
|
import { AdminService } from '@core/http/admin.service';
|
45
|
45
|
import { ActionNotificationShow } from '@core/notification/notification.actions';
|
|
46
|
+import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
|
47
|
+import { AlertDialogComponent } from '@shared/components/dialog/alert-dialog.component';
|
46
|
48
|
|
47
|
49
|
@Injectable({
|
48
|
50
|
providedIn: 'root'
|
...
|
...
|
@@ -60,7 +62,8 @@ export class AuthService { |
60
|
62
|
private utils: UtilsService,
|
61
|
63
|
private dashboardService: DashboardService,
|
62
|
64
|
private adminService: AdminService,
|
63
|
|
- private translate: TranslateService
|
|
65
|
+ private translate: TranslateService,
|
|
66
|
+ private dialog: MatDialog
|
64
|
67
|
) {
|
65
|
68
|
}
|
66
|
69
|
|
...
|
...
|
@@ -273,6 +276,7 @@ export class AuthService { |
273
|
276
|
const refreshToken = this.utils.getQueryParam('refreshToken');
|
274
|
277
|
const username = this.utils.getQueryParam('username');
|
275
|
278
|
const password = this.utils.getQueryParam('password');
|
|
279
|
+ const loginError = this.utils.getQueryParam('loginError');
|
276
|
280
|
if (publicId) {
|
277
|
281
|
return this.publicLogin(publicId).pipe(
|
278
|
282
|
mergeMap((response) => {
|
...
|
...
|
@@ -317,6 +321,10 @@ export class AuthService { |
317
|
321
|
}
|
318
|
322
|
)
|
319
|
323
|
);
|
|
324
|
+ } else if (loginError) {
|
|
325
|
+ this.showLoginErrorDialog(loginError);
|
|
326
|
+ this.utils.updateQueryParam('loginError', null);
|
|
327
|
+ return throwError(Error());
|
320
|
328
|
}
|
321
|
329
|
return this.procceedJwtTokenValidate(doTokenRefresh);
|
322
|
330
|
} else {
|
...
|
...
|
@@ -324,6 +332,22 @@ export class AuthService { |
324
|
332
|
}
|
325
|
333
|
}
|
326
|
334
|
|
|
335
|
+ private showLoginErrorDialog(loginError: string) {
|
|
336
|
+ this.translate.get(['login.error', 'action.close']).subscribe(
|
|
337
|
+ (translations) => {
|
|
338
|
+ const dialogConfig: MatDialogConfig = {
|
|
339
|
+ disableClose: true,
|
|
340
|
+ data: {
|
|
341
|
+ title: translations['login.error'],
|
|
342
|
+ message: loginError,
|
|
343
|
+ ok: translations['action.close']
|
|
344
|
+ }
|
|
345
|
+ };
|
|
346
|
+ this.dialog.open(AlertDialogComponent, dialogConfig);
|
|
347
|
+ }
|
|
348
|
+ );
|
|
349
|
+ }
|
|
350
|
+
|
327
|
351
|
private procceedJwtTokenValidate(doTokenRefresh?: boolean): Observable<AuthPayload> {
|
328
|
352
|
const loadUserSubject = new ReplaySubject<AuthPayload>();
|
329
|
353
|
this.validateJwtToken(doTokenRefresh).subscribe(
|
...
|
...
|
|