Skip to content

Commit

Permalink
feat(server, web): add checkbox to create user screen for shouldChang… (
Browse files Browse the repository at this point in the history
#7598)

feat(server, web): add checkbox to create user screen for shouldChangePassword
  • Loading branch information
samholton committed Mar 4, 2024
1 parent e8b001f commit 7ef202c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions mobile/openapi/doc/CreateUserDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion mobile/openapi/lib/model/create_user_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mobile/openapi/test/create_user_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7672,6 +7672,9 @@
"nullable": true,
"type": "integer"
},
"shouldChangePassword": {
"type": "boolean"
},
"storageLabel": {
"nullable": true,
"type": "string"
Expand Down
1 change: 1 addition & 0 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ export type CreateUserDto = {
name: string;
password: string;
quotaSizeInBytes?: number | null;
shouldChangePassword?: boolean;
storageLabel?: string | null;
};
export type UpdateUserDto = {
Expand Down
4 changes: 4 additions & 0 deletions server/src/domain/user/dto/create-user.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export class CreateUserDto {
@IsPositive()
@ApiProperty({ type: 'integer', format: 'int64' })
quotaSizeInBytes?: number | null;

@Optional()
@IsBoolean()
shouldChangePassword?: boolean;
}

export class CreateAdminDto {
Expand Down
13 changes: 10 additions & 3 deletions web/src/lib/components/forms/create-user-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import Button from '../elements/buttons/button.svelte';
import ImmichLogo from '../shared-components/immich-logo.svelte';
import PasswordField from '../shared-components/password-field.svelte';
import Slider from '../elements/slider.svelte';
let error: string;
let success: string;
let password = '';
let confirmPassword = '';
let shouldChangePassword = true;
let canCreateUser = false;
let quotaSize: number | undefined;
Expand Down Expand Up @@ -54,6 +56,7 @@
createUserDto: {
email: String(email),
password: String(password),
shouldChangePassword: Boolean(shouldChangePassword),
name: String(name),
quotaSizeInBytes: quotaSize ? convertToBytes(Number(quotaSize), 'GiB') : null,
},
Expand All @@ -79,9 +82,6 @@
<div class="flex flex-col place-content-center place-items-center gap-4 px-4">
<ImmichLogo class="text-center" height="100" width="100" />
<h1 class="text-2xl font-medium text-immich-primary dark:text-immich-dark-primary">Create new user</h1>
<p class="rounded-md border p-4 font-mono text-sm text-gray-600 dark:border-immich-dark-bg dark:text-gray-300">
Please provide your user with the password, they will have to change it on their first sign in.
</p>
</div>

<form on:submit|preventDefault={registerUser} autocomplete="off">
Expand All @@ -100,6 +100,13 @@
<PasswordField id="confirmPassword" bind:password={confirmPassword} autocomplete="new-password" />
</div>

<div class="m-4 flex place-items-center justify-between gap-2">
<label class="text-sm dark:text-immich-dark-fg" for="Require user to change password on first login">
Require user to change password on first login
</label>
<Slider bind:checked={shouldChangePassword} />
</div>

<div class="m-4 flex flex-col gap-2">
<label class="immich-form-label" for="name">Name</label>
<input class="immich-form-input" id="name" name="name" type="text" required />
Expand Down

0 comments on commit 7ef202c

Please sign in to comment.