diff --git a/src/frontend/app/ui/gallery/share.service.ts b/src/frontend/app/ui/gallery/share.service.ts index 5cad512e..3ac364dc 100644 --- a/src/frontend/app/ui/gallery/share.service.ts +++ b/src/frontend/app/ui/gallery/share.service.ts @@ -1,17 +1,18 @@ -import { Injectable } from '@angular/core'; -import { NetworkService } from '../../model/network/network.service'; -import { - CreateSharingDTO, - SharingDTO, -} from '../../../../common/entities/SharingDTO'; -import { Router, RoutesRecognized } from '@angular/router'; -import { BehaviorSubject } from 'rxjs'; -import { distinctUntilChanged, filter } from 'rxjs/operators'; -import { QueryParams } from '../../../../common/QueryParams'; -import { UserDTO } from '../../../../common/entities/UserDTO'; +import {Injectable} from '@angular/core'; +import {NetworkService} from '../../model/network/network.service'; +import {CreateSharingDTO, SharingDTO,} from '../../../../common/entities/SharingDTO'; +import {Router, RoutesRecognized} from '@angular/router'; +import {BehaviorSubject} from 'rxjs'; +import {distinctUntilChanged, filter} from 'rxjs/operators'; +import {QueryParams} from '../../../../common/QueryParams'; +import {UserDTO} from '../../../../common/entities/UserDTO'; + @Injectable() export class ShareService { + public readonly UnknownSharingKey = { + sharingKey: 'UnknownSharingKey' + } as SharingDTO; param: string = null; queryParam: string = null; sharingKey: string = null; @@ -40,11 +41,11 @@ export class ShareService { this.param = val.state.root.firstChild.params[ QueryParams.gallery.sharingKey_params - ] || null; + ] || null; this.queryParam = val.state.root.firstChild.queryParams[ QueryParams.gallery.sharingKey_query - ] || null; + ] || null; const changed = this.sharingKey !== (this.param || this.queryParam); if (changed) { @@ -130,6 +131,7 @@ export class ShareService { ); this.sharingSubject.next(sharing); } catch (e) { + this.sharingSubject.next(this.UnknownSharingKey); console.error(e); } } diff --git a/src/frontend/app/ui/sharelogin/share-login.component.html b/src/frontend/app/ui/sharelogin/share-login.component.html index 86e4d99b..831b5c24 100644 --- a/src/frontend/app/ui/sharelogin/share-login.component.html +++ b/src/frontend/app/ui/sharelogin/share-login.component.html @@ -7,7 +7,10 @@
-
+
Unknown sharing key.
+
Wrong password
diff --git a/src/frontend/app/ui/sharelogin/share-login.component.ts b/src/frontend/app/ui/sharelogin/share-login.component.ts index 740839aa..2c1fdbb3 100644 --- a/src/frontend/app/ui/sharelogin/share-login.component.ts +++ b/src/frontend/app/ui/sharelogin/share-login.component.ts @@ -3,6 +3,7 @@ import {AuthenticationService} from '../../model/network/authentication.service' import {ErrorCodes} from '../../../../common/entities/Error'; import {Config} from '../../../../common/config/public/Config'; import {NavigationService} from '../../model/navigation.service'; +import {ShareService} from '../gallery/share.service'; @Component({ selector: 'app-share-login', @@ -16,6 +17,7 @@ export class ShareLoginComponent implements OnInit { title: string; constructor( + public shareService: ShareService, private authService: AuthenticationService, private navigation: NavigationService ) {