mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +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 { 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);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,10 @@
|
||||
</div>
|
||||
<div class="row card align-self-center">
|
||||
<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>
|
||||
|
||||
|
||||
|
@ -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
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user