mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add empty password save error message
This commit is contained in:
parent
ab9f3054d1
commit
f4d3ccfcaf
2 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ import loading from '../../loading/loading';
|
|||
import toast from '../../toast/toast';
|
||||
import ButtonElement from '../../../elements/ButtonElement';
|
||||
import InputElement from '../../../elements/InputElement';
|
||||
import { UserDto } from '@jellyfin/sdk/lib/generated-client';
|
||||
|
||||
type IProps = {
|
||||
userId: string | null;
|
||||
|
@ -14,6 +15,7 @@ type IProps = {
|
|||
|
||||
const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
const element = useRef<HTMLDivElement>(null);
|
||||
let user: UserDto
|
||||
|
||||
const loadUser = useCallback(async () => {
|
||||
const page = element.current;
|
||||
|
@ -28,7 +30,7 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const user = await window.ApiClient.getUser(userId);
|
||||
user = await window.ApiClient.getUser(userId);
|
||||
const loggedInUser = await Dashboard.getCurrentUser();
|
||||
|
||||
if (!user.Policy || !user.Configuration) {
|
||||
|
@ -76,6 +78,8 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
const onSubmit = (e: Event) => {
|
||||
if ((page.querySelector('#txtNewPassword') as HTMLInputElement).value != (page.querySelector('#txtNewPasswordConfirm') as HTMLInputElement).value) {
|
||||
toast(globalize.translate('PasswordMatchError'));
|
||||
} else if((page.querySelector('#txtNewPassword') as HTMLInputElement).value == '' && user.Policy?.IsAdministrator) {
|
||||
toast(globalize.translate('PasswordMissingSaveError'));
|
||||
} else {
|
||||
loading.show();
|
||||
savePassword();
|
||||
|
|
|
@ -1246,6 +1246,7 @@
|
|||
"PasswordResetComplete": "The password has been reset.",
|
||||
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
||||
"PasswordResetProviderHelp": "Pick a password reset provider to be used when this user requests a password reset.",
|
||||
"PasswordMissingSaveError": "New password cannot be empty.",
|
||||
"PasswordSaved": "Password saved.",
|
||||
"PathNotFound": "The path could not be found. Please ensure the path is valid and try again.",
|
||||
"Penciller": "Penciler",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue