[Library | Trunk]: Fix custom error on input. Add verification urls on whitelist of error service interceptor

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60585 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-03-04 14:30:31 +00:00
parent 7ce7dc18cd
commit 3a1ae30fe5
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import {isArray} from "util";
@Injectable() @Injectable()
export class ErrorInterceptorService implements HttpInterceptor { export class ErrorInterceptorService implements HttpInterceptor {
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL]; private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL, properties.registryUrl + 'verification/'];
constructor(private router: Router) { constructor(private router: Router) {
} }
@ -21,7 +21,7 @@ export class ErrorInterceptorService implements HttpInterceptor {
if ((err.status === 0 && properties.registryUrl && this.isService(req, properties.registryUrl)) || if ((err.status === 0 && properties.registryUrl && this.isService(req, properties.registryUrl)) ||
(err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) { (err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) {
this.logOut(); this.logOut();
} else if(err.status === 403) { } else if(err.status === 403 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST)) {
this.unauthorized(); this.unauthorized();
} }
return throwError(err); return throwError(err);

View File

@ -117,6 +117,8 @@ export interface Option {
<span *ngIf="formControl.invalid && formControl.touched" class="uk-text-danger input-message"> <span *ngIf="formControl.invalid && formControl.touched" class="uk-text-danger input-message">
<span *ngIf="formControl.errors.error">{{formControl.errors.error}}</span> <span *ngIf="formControl.errors.error">{{formControl.errors.error}}</span>
<span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span> <span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span>
</span>
<span class="uk-text-danger input-message">
<ng-content select="[error]"></ng-content> <ng-content select="[error]"></ng-content>
</span> </span>
<span *ngIf="formControl.valid" class="uk-text-warning input-message"> <span *ngIf="formControl.valid" class="uk-text-warning input-message">