@@ -16,7 +16,6 @@ import { AuthMethodType } from '../../../../core/auth/models/auth.method-type';
16
16
import { renderAuthMethodFor } from '../log-in.methods-decorator' ;
17
17
import { AuthMethod } from '../../../../core/auth/models/auth.method' ;
18
18
import { AuthService } from '../../../../core/auth/auth.service' ;
19
- import { HardRedirectService } from '../../../../core/services/hard-redirect.service' ;
20
19
import { CoreState } from '../../../../core/core-state.model' ;
21
20
import { getForgotPasswordRoute , getRegisterRoute } from '../../../../app-routing-paths' ;
22
21
import { FeatureID } from '../../../../core/data/feature-authorization/feature-id' ;
@@ -26,6 +25,11 @@ import { getBaseUrl } from '../../../clarin-shared-util';
26
25
import { ConfigurationProperty } from '../../../../core/shared/configuration-property.model' ;
27
26
import { ConfigurationDataService } from '../../../../core/data/configuration-data.service' ;
28
27
import { CookieService } from '../../../../core/services/cookie.service' ;
28
+ import { NotificationsService } from '../../../notifications/notifications.service' ;
29
+ import { TranslateService } from '@ngx-translate/core' ;
30
+ import { NotificationOptions } from '../../../notifications/models/notification-options.model' ;
31
+ import { HELP_DESK_PROPERTY } from '../../../../item-page/tombstone/tombstone.component' ;
32
+ import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators' ;
29
33
30
34
export const SHOW_DISCOJUICE_POPUP_CACHE_NAME = 'SHOW_DISCOJUICE_POPUP' ;
31
35
/**
@@ -96,14 +100,15 @@ export class LogInPasswordComponent implements OnInit {
96
100
@Inject ( 'authMethodProvider' ) public injectedAuthMethodModel : AuthMethod ,
97
101
@Inject ( 'isStandalonePage' ) public isStandalonePage : boolean ,
98
102
private authService : AuthService ,
99
- private hardRedirectService : HardRedirectService ,
100
103
private formBuilder : UntypedFormBuilder ,
101
104
protected store : Store < CoreState > ,
102
105
protected authorizationService : AuthorizationDataService ,
103
106
private route : ActivatedRoute ,
104
107
protected router : Router ,
105
108
protected configurationService : ConfigurationDataService ,
106
109
protected storage : CookieService ,
110
+ private notificationService : NotificationsService ,
111
+ private translateService : TranslateService
107
112
) {
108
113
this . authMethod = injectedAuthMethodModel ;
109
114
}
@@ -113,6 +118,7 @@ export class LogInPasswordComponent implements OnInit {
113
118
* @method ngOnInit
114
119
*/
115
120
public async ngOnInit ( ) {
121
+ this . checkIfHasLoginError ( ) ;
116
122
this . initializeDiscoJuiceCache ( ) ;
117
123
this . redirectUrl = '' ;
118
124
// set formGroup
@@ -155,6 +161,23 @@ export class LogInPasswordComponent implements OnInit {
155
161
return getForgotPasswordRoute ( ) ;
156
162
}
157
163
164
+ private checkIfHasLoginError ( ) {
165
+ const loginError = this . route . snapshot . queryParams ?. error ;
166
+ if ( loginError !== 'shibboleth-authentication-failed' ) {
167
+ return ;
168
+ }
169
+
170
+ // It is a Shibboleth authentication error
171
+ // Load the help desk email from the server
172
+ const helpDeskEmail$ = this . configurationService . findByPropertyName ( HELP_DESK_PROPERTY ) ;
173
+ helpDeskEmail$ . pipe ( getFirstSucceededRemoteDataPayload ( ) )
174
+ . subscribe ( ( helpDeskEmailCfg ) => {
175
+ this . notificationService . error ( this . translateService . instant ( 'login.auth.failed.shibboleth.title' ) ,
176
+ this . translateService . instant ( 'login.auth.failed.shibboleth.message' ,
177
+ { email : helpDeskEmailCfg ?. values ?. [ 0 ] } ) , new NotificationOptions ( - 1 , true ) ) ;
178
+ } ) ;
179
+ }
180
+
158
181
/**
159
182
* Set up redirect URL. It could be loaded from the `authorizationService.getRedirectUrl()` or from the url.
160
183
*/
0 commit comments