You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-09 23:17:29 +02:00
Added mechanism of required password change of new user's first login (#272)
* Deprecate login scenarios that support pre-web era * refactor and simplify setup * Added user info to change password form * change isFistLogin column to shouldChangePassword * Implemented change user password * Implement the change password page for mobile * Change label * Added changes log and up minor version * Fixed typo in the release note * Up server version
This commit is contained in:
@@ -30,7 +30,7 @@ export class AuthService {
|
||||
'lastName',
|
||||
'isAdmin',
|
||||
'profileImagePath',
|
||||
'isFirstLoggedIn',
|
||||
'shouldChangePassword',
|
||||
],
|
||||
},
|
||||
);
|
||||
@@ -66,7 +66,7 @@ export class AuthService {
|
||||
lastName: validatedUser.lastName,
|
||||
isAdmin: validatedUser.isAdmin,
|
||||
profileImagePath: validatedUser.profileImagePath,
|
||||
isFirstLogin: validatedUser.isFirstLoggedIn,
|
||||
shouldChangePassword: validatedUser.shouldChangePassword,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ export class CreateUserDto {
|
||||
isAdmin?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
isFirstLoggedIn?: boolean;
|
||||
shouldChangePassword?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
id?: string;
|
||||
|
@@ -32,6 +32,12 @@ export class UserController {
|
||||
return await this.userService.getAllUsers(authUser, isAll);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('me')
|
||||
async getUserInfo(@GetAuthUser() authUser: AuthUserDto) {
|
||||
return await this.userService.getUserInfo(authUser);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(AdminRolesGuard)
|
||||
@Post()
|
||||
|
@@ -37,6 +37,10 @@ export class UserService {
|
||||
});
|
||||
}
|
||||
|
||||
async getUserInfo(authUser: AuthUserDto) {
|
||||
return this.userRepository.findOne({ id: authUser.id });
|
||||
}
|
||||
|
||||
async getUserCount(isAdmin: boolean) {
|
||||
let users;
|
||||
|
||||
@@ -89,7 +93,8 @@ export class UserService {
|
||||
user.lastName = updateUserDto.lastName || user.lastName;
|
||||
user.firstName = updateUserDto.firstName || user.firstName;
|
||||
user.profileImagePath = updateUserDto.profileImagePath || user.profileImagePath;
|
||||
user.isFirstLoggedIn = updateUserDto.isFirstLoggedIn || user.isFirstLoggedIn;
|
||||
user.shouldChangePassword =
|
||||
updateUserDto.shouldChangePassword != undefined ? updateUserDto.shouldChangePassword : user.shouldChangePassword;
|
||||
|
||||
// If payload includes password - Create new password for user
|
||||
if (updateUserDto.password) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
export const serverVersion = {
|
||||
major: 1,
|
||||
minor: 13,
|
||||
minor: 14,
|
||||
patch: 0,
|
||||
build: 20,
|
||||
build: 21,
|
||||
};
|
||||
|
@@ -98,7 +98,7 @@ describe('User', () => {
|
||||
id: expect.anything(),
|
||||
createdAt: expect.anything(),
|
||||
isAdmin: false,
|
||||
isFirstLoggedIn: true,
|
||||
shouldChangePassword: true,
|
||||
profileImagePath: '',
|
||||
},
|
||||
{
|
||||
@@ -108,7 +108,7 @@ describe('User', () => {
|
||||
id: expect.anything(),
|
||||
createdAt: expect.anything(),
|
||||
isAdmin: false,
|
||||
isFirstLoggedIn: true,
|
||||
shouldChangePassword: true,
|
||||
profileImagePath: '',
|
||||
},
|
||||
]),
|
||||
|
Reference in New Issue
Block a user