From f2cc7c2873a36ba88d3cdbbdb4e48c4663079185 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Sat, 10 Dec 2022 10:36:17 -0600 Subject: [PATCH] Fix(server) fix cannot change user password from mobile app due to first and last name property don't get passed from the app --- server/apps/immich/src/api-v1/user/user.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/apps/immich/src/api-v1/user/user.service.ts b/server/apps/immich/src/api-v1/user/user.service.ts index 6f9da0e9f5..1b629c690f 100644 --- a/server/apps/immich/src/api-v1/user/user.service.ts +++ b/server/apps/immich/src/api-v1/user/user.service.ts @@ -103,7 +103,14 @@ export class UserService { throw new NotFoundException('User not found'); } try { - const updatedUser = await this.userRepository.update(user.id, updateUserDto); + user.password = updateUserDto.password ?? user.password; + user.firstName = updateUserDto.firstName ?? user.firstName; + user.lastName = updateUserDto.lastName ?? user.lastName; + user.isAdmin = updateUserDto.isAdmin ?? user.isAdmin; + user.shouldChangePassword = updateUserDto.shouldChangePassword ?? user.shouldChangePassword; + user.profileImagePath = updateUserDto.profileImagePath ?? user.profileImagePath; + + const updatedUser = await this.userRepository.update(user.id, user); return mapUser(updatedUser); } catch (e) {