mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
Fix 500 error on login with email not in DB (#212)
* Fix 500 error on login with email not in DB * Fix type declarations in ServerInfoDto
This commit is contained in:
parent
a8e723d722
commit
e3449f9c8f
2 changed files with 9 additions and 5 deletions
|
@ -17,7 +17,7 @@ export class AuthService {
|
||||||
private immichJwtService: ImmichJwtService,
|
private immichJwtService: ImmichJwtService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
private async validateUser(loginCredential: LoginCredentialDto): Promise<UserEntity> {
|
private async validateUser(loginCredential: LoginCredentialDto): Promise<UserEntity | null> {
|
||||||
const user = await this.userRepository.findOne(
|
const user = await this.userRepository.findOne(
|
||||||
{ email: loginCredential.email },
|
{ email: loginCredential.email },
|
||||||
{
|
{
|
||||||
|
@ -35,9 +35,13 @@ export class AuthService {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const isAuthenticated = await this.validatePassword(user.password, loginCredential.password, user.salt);
|
const isAuthenticated = await this.validatePassword(user.password, loginCredential.password, user.salt);
|
||||||
|
|
||||||
if (user && isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export class ServerInfoDto {
|
export class ServerInfoDto {
|
||||||
diskSize: String;
|
diskSize: string;
|
||||||
diskUse: String;
|
diskUse: string;
|
||||||
diskAvailable: String;
|
diskAvailable: string;
|
||||||
diskSizeRaw: number;
|
diskSizeRaw: number;
|
||||||
diskUseRaw: number;
|
diskUseRaw: number;
|
||||||
diskAvailableRaw: number;
|
diskAvailableRaw: number;
|
||||||
|
|
Loading…
Reference in a new issue