mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove easy password/pin configuration
This commit is contained in:
parent
0f37d59bb0
commit
4e7d89101e
2 changed files with 1 additions and 149 deletions
|
@ -33,12 +33,9 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
|
||||
LibraryMenu.setTitle(user.Name);
|
||||
|
||||
let showLocalAccessSection = false;
|
||||
|
||||
if (user.HasConfiguredPassword) {
|
||||
(page.querySelector('#btnResetPassword') as HTMLDivElement).classList.remove('hide');
|
||||
(page.querySelector('#fldCurrentPassword') as HTMLDivElement).classList.remove('hide');
|
||||
showLocalAccessSection = true;
|
||||
} else {
|
||||
(page.querySelector('#btnResetPassword') as HTMLDivElement).classList.add('hide');
|
||||
(page.querySelector('#fldCurrentPassword') as HTMLDivElement).classList.add('hide');
|
||||
|
@ -46,23 +43,6 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
|
||||
const canChangePassword = loggedInUser?.Policy?.IsAdministrator || user.Policy.EnableUserPreferenceAccess;
|
||||
(page.querySelector('.passwordSection') as HTMLDivElement).classList.toggle('hide', !canChangePassword);
|
||||
(page.querySelector('.localAccessSection') as HTMLDivElement).classList.toggle('hide', !(showLocalAccessSection && canChangePassword));
|
||||
|
||||
const txtEasyPassword = page.querySelector('#txtEasyPassword') as HTMLInputElement;
|
||||
txtEasyPassword.value = '';
|
||||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
txtEasyPassword.placeholder = '******';
|
||||
(page.querySelector('#btnResetEasyPassword') as HTMLDivElement).classList.remove('hide');
|
||||
} else {
|
||||
txtEasyPassword.removeAttribute('placeholder');
|
||||
txtEasyPassword.placeholder = '';
|
||||
(page.querySelector('#btnResetEasyPassword') as HTMLDivElement).classList.add('hide');
|
||||
}
|
||||
|
||||
const chkEnableLocalEasyPassword = page.querySelector('.chkEnableLocalEasyPassword') as HTMLInputElement;
|
||||
|
||||
chkEnableLocalEasyPassword.checked = user.Configuration.EnableLocalPassword || false;
|
||||
|
||||
import('../../autoFocuser').then(({ default: autoFocuser }) => {
|
||||
autoFocuser.autoFocus(page);
|
||||
|
@ -125,75 +105,6 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
});
|
||||
};
|
||||
|
||||
const onLocalAccessSubmit = (e: Event) => {
|
||||
loading.show();
|
||||
saveEasyPassword();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
};
|
||||
|
||||
const saveEasyPassword = () => {
|
||||
const easyPassword = (page.querySelector('#txtEasyPassword') as HTMLInputElement).value;
|
||||
|
||||
if (easyPassword) {
|
||||
window.ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
||||
onEasyPasswordSaved();
|
||||
}).catch(err => {
|
||||
console.error('[UserPasswordForm] failed to update easy password', err);
|
||||
});
|
||||
} else {
|
||||
onEasyPasswordSaved();
|
||||
}
|
||||
};
|
||||
|
||||
const onEasyPasswordSaved = () => {
|
||||
window.ApiClient.getUser(userId).then(function (user) {
|
||||
if (!user.Configuration) {
|
||||
throw new Error('Unexpected null user.Configuration');
|
||||
}
|
||||
|
||||
if (!user.Id) {
|
||||
throw new Error('Unexpected null user.Id');
|
||||
}
|
||||
|
||||
user.Configuration.EnableLocalPassword = (page.querySelector('.chkEnableLocalEasyPassword') as HTMLInputElement).checked;
|
||||
window.ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
loading.hide();
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
|
||||
loadUser().catch(err => {
|
||||
console.error('[UserPasswordForm] failed to load user', err);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[UserPasswordForm] failed to update user configuration', err);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[UserPasswordForm] failed to fetch user', err);
|
||||
});
|
||||
};
|
||||
|
||||
const resetEasyPassword = () => {
|
||||
const msg = globalize.translate('PinCodeResetConfirmation');
|
||||
|
||||
confirm(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
||||
loading.show();
|
||||
window.ApiClient.resetEasyPassword(userId).then(function () {
|
||||
loading.hide();
|
||||
Dashboard.alert({
|
||||
message: globalize.translate('PinCodeResetComplete'),
|
||||
title: globalize.translate('HeaderPinCodeReset')
|
||||
});
|
||||
loadUser().catch(err => {
|
||||
console.error('[UserPasswordForm] failed to load user', err);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[UserPasswordForm] failed to reset easy password', err);
|
||||
});
|
||||
}).catch(() => {
|
||||
// confirm dialog was closed
|
||||
});
|
||||
};
|
||||
|
||||
const resetPassword = () => {
|
||||
const msg = globalize.translate('PasswordResetConfirmation');
|
||||
confirm(msg, globalize.translate('ResetPassword')).then(function () {
|
||||
|
@ -216,9 +127,6 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
};
|
||||
|
||||
(page.querySelector('.updatePasswordForm') as HTMLFormElement).addEventListener('submit', onSubmit);
|
||||
(page.querySelector('.localAccessForm') as HTMLFormElement).addEventListener('submit', onLocalAccessSubmit);
|
||||
|
||||
(page.querySelector('#btnResetEasyPassword') as HTMLButtonElement).addEventListener('click', resetEasyPassword);
|
||||
(page.querySelector('#btnResetPassword') as HTMLButtonElement).addEventListener('click', resetPassword);
|
||||
}, [loadUser, userId]);
|
||||
|
||||
|
@ -269,53 +177,6 @@ const UserPasswordForm: FunctionComponent<IProps> = ({ userId }: IProps) => {
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<br />
|
||||
<form
|
||||
className='localAccessForm localAccessSection'
|
||||
style={{ margin: '0 auto' }}
|
||||
>
|
||||
<div className='detailSection'>
|
||||
<div className='detailSectionHeader'>
|
||||
{globalize.translate('HeaderEasyPinCode')}
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
{globalize.translate('EasyPasswordHelp')}
|
||||
</div>
|
||||
<br />
|
||||
<div className='inputContainer'>
|
||||
<InputElement
|
||||
type='number'
|
||||
id='txtEasyPassword'
|
||||
label='LabelEasyPinCode'
|
||||
options={'autoComplete="off" pattern="[0-9]*" step="1" maxlength="5"'}
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<div className='checkboxContainer checkboxContainer-withDescription'>
|
||||
<CheckBoxElement
|
||||
className='chkEnableLocalEasyPassword'
|
||||
title='LabelInNetworkSignInWithEasyPassword'
|
||||
/>
|
||||
<div className='fieldDescription checkboxFieldDescription'>
|
||||
{globalize.translate('LabelInNetworkSignInWithEasyPasswordHelp')}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<ButtonElement
|
||||
type='submit'
|
||||
className='raised button-submit block'
|
||||
title='Save'
|
||||
/>
|
||||
<ButtonElement
|
||||
type='button'
|
||||
id='btnResetEasyPassword'
|
||||
className='raised button-cancel block hide'
|
||||
title='ButtonResetEasyPassword'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -99,7 +99,6 @@
|
|||
"ButtonRefreshGuideData": "Refresh Guide Data",
|
||||
"ButtonRemove": "Remove",
|
||||
"ButtonRename": "Rename",
|
||||
"ButtonResetEasyPassword": "Reset Easy PIN code",
|
||||
"ButtonResume": "Resume",
|
||||
"ButtonRevoke": "Revoke",
|
||||
"ButtonScanAllLibraries": "Scan All Libraries",
|
||||
|
@ -211,7 +210,6 @@
|
|||
"DownloadsValue": "{0} downloads",
|
||||
"DrmChannelsNotImported": "Channels with DRM will not be imported.",
|
||||
"DropShadow": "Drop Shadow",
|
||||
"EasyPasswordHelp": "Your Easy PIN code is used for offline access on supported clients and can also be used for easy in-network sign in.",
|
||||
"Edit": "Edit",
|
||||
"EditImages": "Edit images",
|
||||
"EditMetadata": "Edit metadata",
|
||||
|
@ -366,7 +364,6 @@
|
|||
"HeaderDownloadSync": "Download & Sync",
|
||||
"HeaderDummyChapter": "Chapter Images",
|
||||
"HeaderDVR": "DVR",
|
||||
"HeaderEasyPinCode": "Easy PIN Code",
|
||||
"HeaderEditImages": "Edit Images",
|
||||
"HeaderEnabledFields": "Enabled Fields",
|
||||
"HeaderEnabledFieldsHelp": "Uncheck a field to lock it and prevent its data from being changed.",
|
||||
|
@ -426,7 +423,6 @@
|
|||
"HeaderPaths": "Paths",
|
||||
"HeaderPerformance": "Performance",
|
||||
"HeaderPhotoAlbums": "Photo Albums",
|
||||
"HeaderPinCodeReset": "Reset Easy PIN Code",
|
||||
"HeaderPlayAll": "Play All",
|
||||
"HeaderPlayback": "Media playback",
|
||||
"HeaderPlaybackError": "Playback Error",
|
||||
|
@ -638,7 +634,6 @@
|
|||
"LabelChapterImageResolution": "Resolution",
|
||||
"LabelChapterImageResolutionHelp": "The resolution of the extracted chapter images. Changing this will have no effect on existing dummy chapters.",
|
||||
"LabelDynamicExternalId": "{0} Id",
|
||||
"LabelEasyPinCode": "Easy PIN code",
|
||||
"LabelEmbedAlbumArtDidl": "Embed album art in DIDL",
|
||||
"LabelEmbedAlbumArtDidlHelp": "Some devices prefer this method for getting the album art. Others may fail to play with this option enabled.",
|
||||
"LabelEnableAudioVbr": "Enable VBR audio encoding",
|
||||
|
@ -707,8 +702,6 @@
|
|||
"LabelImageFetchersHelp": "Enable and rank your preferred image fetchers in order of priority.",
|
||||
"LabelImageType": "Image type",
|
||||
"LabelImportOnlyFavoriteChannels": "Restrict to channels marked as favorite",
|
||||
"LabelInNetworkSignInWithEasyPassword": "Enable in-network sign in with my Easy PIN code",
|
||||
"LabelInNetworkSignInWithEasyPasswordHelp": "Use the Easy PIN code to sign in from clients within your local network. Your regular password will only be needed away from home. If the PIN code is left blank, you won't need a password within your home network.",
|
||||
"LabelInternetQuality": "Internet quality",
|
||||
"LabelIsForced": "Forced",
|
||||
"LabelKeepUpTo": "Keep up to",
|
||||
|
@ -1107,7 +1100,7 @@
|
|||
"MessageNoServersAvailable": "No servers have been found using the automatic server discovery.",
|
||||
"MessageNothingHere": "Nothing here.",
|
||||
"MessageNoTrailersFound": "Install the trailers channel to enhance your movie experience by adding a library of internet trailers.",
|
||||
"MessagePasswordResetForUsers": "The following users have had their passwords reset. They can now sign in with the Easy PIN codes that were used to do the reset.",
|
||||
"MessagePasswordResetForUsers": "The following users have had their passwords reset. They can now sign in with the PIN codes that were used to do the reset.",
|
||||
"MessagePlayAccessRestricted": "Playback of this content is currently restricted. Please contact your server administrator for more information.",
|
||||
"MessagePleaseEnsureInternetMetadata": "Please ensure downloading of internet metadata is enabled.",
|
||||
"MessagePleaseWait": "Please wait. This may take a minute.",
|
||||
|
@ -1315,8 +1308,6 @@
|
|||
"Photo": "Photo",
|
||||
"Photos": "Photos",
|
||||
"PictureInPicture": "Picture in picture",
|
||||
"PinCodeResetComplete": "The Easy PIN code has been reset.",
|
||||
"PinCodeResetConfirmation": "Are you sure you wish to reset the Easy PIN code?",
|
||||
"PlaceFavoriteChannelsAtBeginning": "Place favorite channels at the beginning",
|
||||
"Play": "Play",
|
||||
"PlayAllFromHere": "Play all from here",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue