mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Backport pull request #5732 from jellyfin-web/release-10.9.z
Fix dashboard user page crash
Original-merge: 2d2d5bef94
Merged-by: thornbill <thornbill@users.noreply.github.com>
Backported-by: Bill Thornton <thornbill@users.noreply.github.com>
This commit is contained in:
parent
fa9621e31a
commit
c5b338dc64
8 changed files with 155 additions and 35 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue