1
0
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:
Patrik J. Braun 2023-02-21 10:54:42 +01:00
parent b793e48d70
commit 4ad074b49e
3 changed files with 21 additions and 14 deletions

View File

@ -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;
@ -130,6 +131,7 @@ export class ShareService {
);
this.sharingSubject.next(sharing);
} catch (e) {
this.sharingSubject.next(this.UnknownSharingKey);
console.error(e);
}
}

View File

@ -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>

View File

@ -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
) {