mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix(server) Cannot change first time password due to null in first and last name payload (#1205)
* fix(server) Cannot change first time password due to null in first and last name payload * Added error message for form on the web
This commit is contained in:
@@ -35,11 +35,25 @@ export class UserCore {
|
||||
}
|
||||
}
|
||||
|
||||
const user = await this.userRepository.get(id);
|
||||
if (!user) {
|
||||
throw new NotFoundException('User not found');
|
||||
}
|
||||
|
||||
try {
|
||||
if (dto.password) {
|
||||
dto.password = await hash(dto.password, SALT_ROUNDS);
|
||||
}
|
||||
return this.userRepository.update(id, dto);
|
||||
|
||||
user.password = dto.password ?? user.password;
|
||||
user.email = dto.email ?? user.email;
|
||||
user.firstName = dto.firstName ?? user.firstName;
|
||||
user.lastName = dto.lastName ?? user.lastName;
|
||||
user.isAdmin = dto.isAdmin ?? user.isAdmin;
|
||||
user.shouldChangePassword = dto.shouldChangePassword ?? user.shouldChangePassword;
|
||||
user.profileImagePath = dto.profileImagePath ?? user.profileImagePath;
|
||||
|
||||
return this.userRepository.update(id, user);
|
||||
} catch (e) {
|
||||
Logger.error(e, 'Failed to update user info');
|
||||
throw new InternalServerErrorException('Failed to update user info');
|
||||
|
||||
Reference in New Issue
Block a user