Backport pull request #5732 from jellyfin-web/release-10.9.z
Fix dashboard user page crash Original-merge: 2d2d5bef943758b1e4d19ded30feb6e4ff3f8ffd Merged-by: thornbill <thornbill@users.noreply.github.com> Backported-by: Bill Thornton <thornbill@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import ButtonElement from '../../../elements/ButtonElement';
|
||||
import InputElement from '../../../elements/InputElement';
|
||||
|
||||
type IProps = {
|
||||
userId: string;
|
||||
userId: string | null;
|
||||
};
|
||||
|
||||
const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
@@ -19,7 +19,12 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
const page = element.current;
|
||||
|
||||
if (!page) {
|
||||
console.error('Unexpected null reference');
|
||||
console.error('[UserPasswordForm] Unexpected null page reference');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userId) {
|
||||
console.error('[UserPasswordForm] missing user id');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +63,7 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
const page = element.current;
|
||||
|
||||
if (!page) {
|
||||
console.error('Unexpected null reference');
|
||||
console.error('[UserPasswordForm] Unexpected null page reference');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,6 +84,11 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
};
|
||||
|
||||
const savePassword = () => {
|
||||
if (!userId) {
|
||||
console.error('[UserPasswordForm.savePassword] missing user id');
|
||||
return;
|
||||
}
|
||||
|
||||
let currentPassword = (page.querySelector('#txtCurrentPassword') as HTMLInputElement).value;
|
||||
const newPassword = (page.querySelector('#txtNewPassword') as HTMLInputElement).value;
|
||||
|
||||
@@ -105,6 +115,11 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
||||
};
|
||||
|
||||
const resetPassword = () => {
|
||||
if (!userId) {
|
||||
console.error('[UserPasswordForm.resetPassword] missing user id');
|
||||
return;
|
||||
}
|
||||
|
||||
const msg = globalize.translate('PasswordResetConfirmation');
|
||||
confirm(msg, globalize.translate('ResetPassword')).then(function () {
|
||||
loading.show();
|
||||
|
||||
Reference in New Issue
Block a user