mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Require password before setting as admin
This commit is contained in:
parent
84f22cea3a
commit
cbe213710d
2 changed files with 9 additions and 0 deletions
|
@ -199,6 +199,8 @@ const UserEdit = () => {
|
||||||
throw new Error('Unexpected null user id or policy');
|
throw new Error('Unexpected null user id or policy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPreviouslyAdmin = user.Policy.IsAdministrator;
|
||||||
|
|
||||||
user.Name = (page.querySelector('#txtUserName') as HTMLInputElement).value.trim();
|
user.Name = (page.querySelector('#txtUserName') as HTMLInputElement).value.trim();
|
||||||
user.Policy.IsAdministrator = (page.querySelector('.chkIsAdmin') as HTMLInputElement).checked;
|
user.Policy.IsAdministrator = (page.querySelector('.chkIsAdmin') as HTMLInputElement).checked;
|
||||||
user.Policy.IsHidden = (page.querySelector('.chkIsHidden') as HTMLInputElement).checked;
|
user.Policy.IsHidden = (page.querySelector('.chkIsHidden') as HTMLInputElement).checked;
|
||||||
|
@ -225,6 +227,12 @@ const UserEdit = () => {
|
||||||
user.Policy.EnableContentDeletionFromFolders = user.Policy.EnableContentDeletion ? [] : getCheckedElementDataIds(page.querySelectorAll('.chkFolder'));
|
user.Policy.EnableContentDeletionFromFolders = user.Policy.EnableContentDeletion ? [] : getCheckedElementDataIds(page.querySelectorAll('.chkFolder'));
|
||||||
user.Policy.SyncPlayAccess = (page.querySelector('#selectSyncPlayAccess') as HTMLSelectElement).value as SyncPlayUserAccessType;
|
user.Policy.SyncPlayAccess = (page.querySelector('#selectSyncPlayAccess') as HTMLSelectElement).value as SyncPlayUserAccessType;
|
||||||
|
|
||||||
|
if (!user.HasPassword && user.Policy.IsAdministrator && !isPreviouslyAdmin) {
|
||||||
|
toast(globalize.translate('PasswordAdminRequired'));
|
||||||
|
loading.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
window.ApiClient.updateUser(user).then(() => (
|
window.ApiClient.updateUser(user).then(() => (
|
||||||
window.ApiClient.updateUserPolicy(user.Id || '', user.Policy || { PasswordResetProviderId: '', AuthenticationProviderId: '' })
|
window.ApiClient.updateUserPolicy(user.Id || '', user.Policy || { PasswordResetProviderId: '', AuthenticationProviderId: '' })
|
||||||
)).then(() => {
|
)).then(() => {
|
||||||
|
|
|
@ -1318,6 +1318,7 @@
|
||||||
"PackageInstallFailed": "{0} (version {1}) installation failed.",
|
"PackageInstallFailed": "{0} (version {1}) installation failed.",
|
||||||
"PageNotFound": "This is not the page you are looking for.",
|
"PageNotFound": "This is not the page you are looking for.",
|
||||||
"ParentalRating": "Parental rating",
|
"ParentalRating": "Parental rating",
|
||||||
|
"PasswordAdminRequired": "The user must have a password set before marking them as admin.",
|
||||||
"PasswordMatchError": "Password and password confirmation must match.",
|
"PasswordMatchError": "Password and password confirmation must match.",
|
||||||
"PasswordRequiredForAdmin": "A password is required for admin accounts.",
|
"PasswordRequiredForAdmin": "A password is required for admin accounts.",
|
||||||
"PasswordResetComplete": "The password has been reset.",
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue