clarify password changes for local auth users

This commit is contained in:
Igor Serebryany 2023-10-06 15:12:29 -07:00
parent 20356a17d8
commit 096b5496b3
No known key found for this signature in database
GPG key ID: 0AF607692FD9EB24
2 changed files with 22 additions and 5 deletions

View file

@ -20,14 +20,17 @@
<div class="w-full h-px bg-white/10 my-4" /> <div class="w-full h-px bg-white/10 my-4" />
<p v-if="!isGuest" class="mb-4 text-lg">{{ $strings.HeaderChangePassword }}</p> <p v-if="!isGuest" class="mb-4 text-lg">{{ $strings.HeaderChangePassword }}</p>
<p v-if="isFromProxy" class="py-2">{{ $strings.NoteChangeProxyPassword }}</p>
<form v-if="!isGuest" @submit.prevent="submitChangePassword"> <form v-if="!isGuest" @submit.prevent="submitChangePassword">
<ui-text-input-with-label v-model="password" :disabled="changingPassword" type="password" :label="$strings.LabelPassword" class="my-2" /> <ui-text-input-with-label v-if="!isFromProxy" v-model="password" :disabled="changingPassword" type="password" :label="$strings.LabelPassword" class="my-2" />
<ui-text-input-with-label v-model="newPassword" :disabled="changingPassword" type="password" :label="$strings.LabelNewPassword" class="my-2" /> <ui-text-input-with-label v-model="newPassword" :disabled="changingPassword" type="password" :label="$strings.LabelNewPassword" class="my-2" />
<ui-text-input-with-label v-model="confirmPassword" :disabled="changingPassword" type="password" :label="$strings.LabelConfirmPassword" class="my-2" /> <ui-text-input-with-label v-if="!isFromProxy" v-model="confirmPassword" :disabled="changingPassword" type="password" :label="$strings.LabelConfirmPassword" class="my-2" />
<div class="flex items-center py-2"> <div class="flex items-center py-2">
<p v-if="isRoot" class="text-error py-2 text-xs">* {{ $strings.NoteChangeRootPassword }}</p> <p v-if="isRoot" class="text-error py-2 text-xs">* {{ $strings.NoteChangeRootPassword }}</p>
<div class="flex-grow" /> <div class="flex-grow" />
<ui-btn v-show="(password && newPassword && confirmPassword) || isRoot" type="submit" :loading="changingPassword" color="success">{{ $strings.ButtonSubmit }}</ui-btn> <ui-btn v-if="canSubmitPwChange" type="submit" :loading="changingPassword" color="success">{{ $strings.ButtonSubmit }}</ui-btn>
</div> </div>
</form> </form>
</div> </div>
@ -68,7 +71,20 @@ export default {
}, },
isGuest() { isGuest() {
return this.usertype === 'guest' return this.usertype === 'guest'
} },
isFromProxy() {
return this.user.isFromProxy
},
canSubmitPwChange() {
if (this.isGuest) return false;
if (this.isRoot) return true;
if (!this.password && !this.isFromProxy) return false;
if (!this.newPassword && !this.isRoot) return false;
if (!this.confirmPassword && !this.isFromProxy) return false;
return true
},
}, },
methods: { methods: {
updateLocalLanguage(lang) { updateLocalLanguage(lang) {
@ -96,7 +112,7 @@ export default {
this.confirmPassword = null this.confirmPassword = null
}, },
submitChangePassword() { submitChangePassword() {
if (this.newPassword !== this.confirmPassword) { if (this.newPassword !== this.confirmPassword && !this.isFromProxy) {
return this.$toast.error('New password and confirm password do not match') return this.$toast.error('New password and confirm password do not match')
} }
if (this.password === this.newPassword) { if (this.password === this.newPassword) {

View file

@ -635,6 +635,7 @@
"MessageXLibraryIsEmpty": "{0} Library is empty!", "MessageXLibraryIsEmpty": "{0} Library is empty!",
"MessageYourAudiobookDurationIsLonger": "Your audiobook duration is longer than the duration found", "MessageYourAudiobookDurationIsLonger": "Your audiobook duration is longer than the duration found",
"MessageYourAudiobookDurationIsShorter": "Your audiobook duration is shorter than duration found", "MessageYourAudiobookDurationIsShorter": "Your audiobook duration is shorter than duration found",
"NoteChangeProxyPassword": "The password you configure here will not work with this website. It is only needed for the Audiobookshelf mobile app.",
"NoteChangeRootPassword": "Root user is the only user that can have an empty password", "NoteChangeRootPassword": "Root user is the only user that can have an empty password",
"NoteChapterEditorTimes": "Note: First chapter start time must remain at 0:00 and the last chapter start time cannot exceed this audiobooks duration.", "NoteChapterEditorTimes": "Note: First chapter start time must remain at 0:00 and the last chapter start time cannot exceed this audiobooks duration.",
"NoteFolderPicker": "Note: folders already mapped will not be shown", "NoteFolderPicker": "Note: folders already mapped will not be shown",