mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
feat(server, web): add checkbox to create user screen for shouldChang… (#7598)
feat(server, web): add checkbox to create user screen for shouldChangePassword
This commit is contained in:
parent
e8b001f62f
commit
7ef202c8b2
1
mobile/openapi/doc/CreateUserDto.md
generated
1
mobile/openapi/doc/CreateUserDto.md
generated
@ -13,6 +13,7 @@ Name | Type | Description | Notes
|
|||||||
**name** | **String** | |
|
**name** | **String** | |
|
||||||
**password** | **String** | |
|
**password** | **String** | |
|
||||||
**quotaSizeInBytes** | **int** | | [optional]
|
**quotaSizeInBytes** | **int** | | [optional]
|
||||||
|
**shouldChangePassword** | **bool** | | [optional]
|
||||||
**storageLabel** | **String** | | [optional]
|
**storageLabel** | **String** | | [optional]
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
19
mobile/openapi/lib/model/create_user_dto.dart
generated
19
mobile/openapi/lib/model/create_user_dto.dart
generated
@ -18,6 +18,7 @@ class CreateUserDto {
|
|||||||
required this.name,
|
required this.name,
|
||||||
required this.password,
|
required this.password,
|
||||||
this.quotaSizeInBytes,
|
this.quotaSizeInBytes,
|
||||||
|
this.shouldChangePassword,
|
||||||
this.storageLabel,
|
this.storageLabel,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -37,6 +38,14 @@ class CreateUserDto {
|
|||||||
|
|
||||||
int? quotaSizeInBytes;
|
int? quotaSizeInBytes;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
bool? shouldChangePassword;
|
||||||
|
|
||||||
String? storageLabel;
|
String? storageLabel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,6 +55,7 @@ class CreateUserDto {
|
|||||||
other.name == name &&
|
other.name == name &&
|
||||||
other.password == password &&
|
other.password == password &&
|
||||||
other.quotaSizeInBytes == quotaSizeInBytes &&
|
other.quotaSizeInBytes == quotaSizeInBytes &&
|
||||||
|
other.shouldChangePassword == shouldChangePassword &&
|
||||||
other.storageLabel == storageLabel;
|
other.storageLabel == storageLabel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -56,10 +66,11 @@ class CreateUserDto {
|
|||||||
(name.hashCode) +
|
(name.hashCode) +
|
||||||
(password.hashCode) +
|
(password.hashCode) +
|
||||||
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
|
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
|
||||||
|
(shouldChangePassword == null ? 0 : shouldChangePassword!.hashCode) +
|
||||||
(storageLabel == null ? 0 : storageLabel!.hashCode);
|
(storageLabel == null ? 0 : storageLabel!.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'CreateUserDto[email=$email, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, storageLabel=$storageLabel]';
|
String toString() => 'CreateUserDto[email=$email, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -76,6 +87,11 @@ class CreateUserDto {
|
|||||||
} else {
|
} else {
|
||||||
// json[r'quotaSizeInBytes'] = null;
|
// json[r'quotaSizeInBytes'] = null;
|
||||||
}
|
}
|
||||||
|
if (this.shouldChangePassword != null) {
|
||||||
|
json[r'shouldChangePassword'] = this.shouldChangePassword;
|
||||||
|
} else {
|
||||||
|
// json[r'shouldChangePassword'] = null;
|
||||||
|
}
|
||||||
if (this.storageLabel != null) {
|
if (this.storageLabel != null) {
|
||||||
json[r'storageLabel'] = this.storageLabel;
|
json[r'storageLabel'] = this.storageLabel;
|
||||||
} else {
|
} else {
|
||||||
@ -97,6 +113,7 @@ class CreateUserDto {
|
|||||||
name: mapValueOfType<String>(json, r'name')!,
|
name: mapValueOfType<String>(json, r'name')!,
|
||||||
password: mapValueOfType<String>(json, r'password')!,
|
password: mapValueOfType<String>(json, r'password')!,
|
||||||
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
|
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
|
||||||
|
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'),
|
||||||
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
|
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
5
mobile/openapi/test/create_user_dto_test.dart
generated
5
mobile/openapi/test/create_user_dto_test.dart
generated
@ -41,6 +41,11 @@ void main() {
|
|||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// bool shouldChangePassword
|
||||||
|
test('to test the property `shouldChangePassword`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
// String storageLabel
|
// String storageLabel
|
||||||
test('to test the property `storageLabel`', () async {
|
test('to test the property `storageLabel`', () async {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -7672,6 +7672,9 @@
|
|||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"shouldChangePassword": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"storageLabel": {
|
"storageLabel": {
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -958,6 +958,7 @@ export type CreateUserDto = {
|
|||||||
name: string;
|
name: string;
|
||||||
password: string;
|
password: string;
|
||||||
quotaSizeInBytes?: number | null;
|
quotaSizeInBytes?: number | null;
|
||||||
|
shouldChangePassword?: boolean;
|
||||||
storageLabel?: string | null;
|
storageLabel?: string | null;
|
||||||
};
|
};
|
||||||
export type UpdateUserDto = {
|
export type UpdateUserDto = {
|
||||||
|
@ -30,6 +30,10 @@ export class CreateUserDto {
|
|||||||
@IsPositive()
|
@IsPositive()
|
||||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||||
quotaSizeInBytes?: number | null;
|
quotaSizeInBytes?: number | null;
|
||||||
|
|
||||||
|
@Optional()
|
||||||
|
@IsBoolean()
|
||||||
|
shouldChangePassword?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateAdminDto {
|
export class CreateAdminDto {
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
import Button from '../elements/buttons/button.svelte';
|
import Button from '../elements/buttons/button.svelte';
|
||||||
import ImmichLogo from '../shared-components/immich-logo.svelte';
|
import ImmichLogo from '../shared-components/immich-logo.svelte';
|
||||||
import PasswordField from '../shared-components/password-field.svelte';
|
import PasswordField from '../shared-components/password-field.svelte';
|
||||||
|
import Slider from '../elements/slider.svelte';
|
||||||
|
|
||||||
let error: string;
|
let error: string;
|
||||||
let success: string;
|
let success: string;
|
||||||
|
|
||||||
let password = '';
|
let password = '';
|
||||||
let confirmPassword = '';
|
let confirmPassword = '';
|
||||||
|
let shouldChangePassword = true;
|
||||||
|
|
||||||
let canCreateUser = false;
|
let canCreateUser = false;
|
||||||
let quotaSize: number | undefined;
|
let quotaSize: number | undefined;
|
||||||
@ -54,6 +56,7 @@
|
|||||||
createUserDto: {
|
createUserDto: {
|
||||||
email: String(email),
|
email: String(email),
|
||||||
password: String(password),
|
password: String(password),
|
||||||
|
shouldChangePassword: Boolean(shouldChangePassword),
|
||||||
name: String(name),
|
name: String(name),
|
||||||
quotaSizeInBytes: quotaSize ? convertToBytes(Number(quotaSize), 'GiB') : null,
|
quotaSizeInBytes: quotaSize ? convertToBytes(Number(quotaSize), 'GiB') : null,
|
||||||
},
|
},
|
||||||
@ -79,9 +82,6 @@
|
|||||||
<div class="flex flex-col place-content-center place-items-center gap-4 px-4">
|
<div class="flex flex-col place-content-center place-items-center gap-4 px-4">
|
||||||
<ImmichLogo class="text-center" height="100" width="100" />
|
<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>
|
<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>
|
</div>
|
||||||
|
|
||||||
<form on:submit|preventDefault={registerUser} autocomplete="off">
|
<form on:submit|preventDefault={registerUser} autocomplete="off">
|
||||||
@ -100,6 +100,13 @@
|
|||||||
<PasswordField id="confirmPassword" bind:password={confirmPassword} autocomplete="new-password" />
|
<PasswordField id="confirmPassword" bind:password={confirmPassword} autocomplete="new-password" />
|
||||||
</div>
|
</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">
|
<div class="m-4 flex flex-col gap-2">
|
||||||
<label class="immich-form-label" for="name">Name</label>
|
<label class="immich-form-label" for="name">Name</label>
|
||||||
<input class="immich-form-input" id="name" name="name" type="text" required />
|
<input class="immich-form-input" id="name" name="name" type="text" required />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user