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 toast from '../../toast/toast';
|
||||||
import ButtonElement from '../../../elements/ButtonElement';
|
import ButtonElement from '../../../elements/ButtonElement';
|
||||||
import InputElement from '../../../elements/InputElement';
|
import InputElement from '../../../elements/InputElement';
|
||||||
|
import { UserDto } from '@jellyfin/sdk/lib/generated-client';
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
userId: string | null;
|
userId: string | null;
|
||||||
|
@ -14,6 +15,7 @@ type IProps = {
|
||||||
|
|
||||||
const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||||
const element = useRef<HTMLDivElement>(null);
|
const element = useRef<HTMLDivElement>(null);
|
||||||
|
let user: UserDto
|
||||||
|
|
||||||
const loadUser = useCallback(async () => {
|
const loadUser = useCallback(async () => {
|
||||||
const page = element.current;
|
const page = element.current;
|
||||||
|
@ -28,7 +30,7 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await window.ApiClient.getUser(userId);
|
user = await window.ApiClient.getUser(userId);
|
||||||
const loggedInUser = await Dashboard.getCurrentUser();
|
const loggedInUser = await Dashboard.getCurrentUser();
|
||||||
|
|
||||||
if (!user.Policy || !user.Configuration) {
|
if (!user.Policy || !user.Configuration) {
|
||||||
|
@ -76,6 +78,8 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||||
const onSubmit = (e: Event) => {
|
const onSubmit = (e: Event) => {
|
||||||
if ((page.querySelector('#txtNewPassword') as HTMLInputElement).value != (page.querySelector('#txtNewPasswordConfirm') as HTMLInputElement).value) {
|
if ((page.querySelector('#txtNewPassword') as HTMLInputElement).value != (page.querySelector('#txtNewPasswordConfirm') as HTMLInputElement).value) {
|
||||||
toast(globalize.translate('PasswordMatchError'));
|
toast(globalize.translate('PasswordMatchError'));
|
||||||
|
} else if((page.querySelector('#txtNewPassword') as HTMLInputElement).value == '' && user.Policy?.IsAdministrator) {
|
||||||
|
toast(globalize.translate('PasswordMissingSaveError'));
|
||||||
} else {
|
} else {
|
||||||
loading.show();
|
loading.show();
|
||||||
savePassword();
|
savePassword();
|
||||||
|
|
|
@ -1246,6 +1246,7 @@
|
||||||
"PasswordResetComplete": "The password has been reset.",
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
"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.",
|
"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.",
|
"PasswordSaved": "Password saved.",
|
||||||
"PathNotFound": "The path could not be found. Please ensure the path is valid and try again.",
|
"PathNotFound": "The path could not be found. Please ensure the path is valid and try again.",
|
||||||
"Penciller": "Penciler",
|
"Penciller": "Penciler",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue