From 4e7d89101e213db70b7a7a8c09768da379a74671 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 13 Jul 2023 10:29:47 -0400 Subject: [PATCH] Remove easy password/pin configuration --- .../dashboard/users/UserPasswordForm.tsx | 139 ------------------ src/strings/en-us.json | 11 +- 2 files changed, 1 insertion(+), 149 deletions(-) diff --git a/src/components/dashboard/users/UserPasswordForm.tsx b/src/components/dashboard/users/UserPasswordForm.tsx index d7801fdb4..cfe648281 100644 --- a/src/components/dashboard/users/UserPasswordForm.tsx +++ b/src/components/dashboard/users/UserPasswordForm.tsx @@ -33,12 +33,9 @@ const UserPasswordForm: FunctionComponent = ({ 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 = ({ 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 = ({ 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 = ({ 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 = ({ userId }: IProps) => { -
-
-
-
- {globalize.translate('HeaderEasyPinCode')} -
-
-
- {globalize.translate('EasyPasswordHelp')} -
-
-
- -
-
-
- -
- {globalize.translate('LabelInNetworkSignInWithEasyPasswordHelp')} -
-
-
- - -
-
-
); }; diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 1a3fdc47a..a6b63ec3d 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -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",