mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Fixing error message with unknown sharing key. fixes #602
This commit is contained in:
parent
b793e48d70
commit
4ad074b49e
@ -1,17 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import { NetworkService } from '../../model/network/network.service';
|
import {NetworkService} from '../../model/network/network.service';
|
||||||
import {
|
import {CreateSharingDTO, SharingDTO,} from '../../../../common/entities/SharingDTO';
|
||||||
CreateSharingDTO,
|
import {Router, RoutesRecognized} from '@angular/router';
|
||||||
SharingDTO,
|
import {BehaviorSubject} from 'rxjs';
|
||||||
} from '../../../../common/entities/SharingDTO';
|
import {distinctUntilChanged, filter} from 'rxjs/operators';
|
||||||
import { Router, RoutesRecognized } from '@angular/router';
|
import {QueryParams} from '../../../../common/QueryParams';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import {UserDTO} from '../../../../common/entities/UserDTO';
|
||||||
import { distinctUntilChanged, filter } from 'rxjs/operators';
|
|
||||||
import { QueryParams } from '../../../../common/QueryParams';
|
|
||||||
import { UserDTO } from '../../../../common/entities/UserDTO';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ShareService {
|
export class ShareService {
|
||||||
|
public readonly UnknownSharingKey = {
|
||||||
|
sharingKey: 'UnknownSharingKey'
|
||||||
|
} as SharingDTO;
|
||||||
param: string = null;
|
param: string = null;
|
||||||
queryParam: string = null;
|
queryParam: string = null;
|
||||||
sharingKey: string = null;
|
sharingKey: string = null;
|
||||||
@ -130,6 +131,7 @@ export class ShareService {
|
|||||||
);
|
);
|
||||||
this.sharingSubject.next(sharing);
|
this.sharingSubject.next(sharing);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
this.sharingSubject.next(this.UnknownSharingKey);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row card align-self-center">
|
<div class="row card align-self-center">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form name="form" id="form" class="form-horizontal" #LoginForm="ngForm" (submit)="onLogin()">
|
<div *ngIf="(shareService.currentSharing | async) == shareService.UnknownSharingKey"
|
||||||
|
class="h3 text-center text-danger" i18n>Unknown sharing key.</div>
|
||||||
|
<form *ngIf="(shareService.currentSharing | async) != shareService.UnknownSharingKey"
|
||||||
|
name="form" id="form" class="form-horizontal" #LoginForm="ngForm" (submit)="onLogin()">
|
||||||
<div class="error-message" [hidden]="loginError==false" i18n>Wrong password</div>
|
<div class="error-message" [hidden]="loginError==false" i18n>Wrong password</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import {AuthenticationService} from '../../model/network/authentication.service'
|
|||||||
import {ErrorCodes} from '../../../../common/entities/Error';
|
import {ErrorCodes} from '../../../../common/entities/Error';
|
||||||
import {Config} from '../../../../common/config/public/Config';
|
import {Config} from '../../../../common/config/public/Config';
|
||||||
import {NavigationService} from '../../model/navigation.service';
|
import {NavigationService} from '../../model/navigation.service';
|
||||||
|
import {ShareService} from '../gallery/share.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-share-login',
|
selector: 'app-share-login',
|
||||||
@ -16,6 +17,7 @@ export class ShareLoginComponent implements OnInit {
|
|||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
public shareService: ShareService,
|
||||||
private authService: AuthenticationService,
|
private authService: AuthenticationService,
|
||||||
private navigation: NavigationService
|
private navigation: NavigationService
|
||||||
) {
|
) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user