Update: account modal strings

This commit is contained in:
Nicholas Wallace 2024-08-18 17:15:37 -07:00
parent c2f41d5bc4
commit 039d7b7b7c
2 changed files with 22 additions and 10 deletions

View file

@ -111,7 +111,7 @@
</div> </div>
<div class="flex pt-4 px-2"> <div class="flex pt-4 px-2">
<ui-btn v-if="hasOpenIDLink" small :loading="unlinkingFromOpenID" color="primary" type="button" class="mr-2" @click.stop="unlinkOpenID">Unlink OpenID</ui-btn> <ui-btn v-if="hasOpenIDLink" small :loading="unlinkingFromOpenID" color="primary" type="button" class="mr-2" @click.stop="unlinkOpenID">{{ $strings.ButtonUnlinkOpenId }}</ui-btn>
<ui-btn v-if="isEditingRoot" small class="flex items-center" to="/account">{{ $strings.ButtonChangeRootPassword }}</ui-btn> <ui-btn v-if="isEditingRoot" small class="flex items-center" to="/account">{{ $strings.ButtonChangeRootPassword }}</ui-btn>
<div class="flex-grow" /> <div class="flex-grow" />
<ui-btn color="success" type="submit">{{ $strings.ButtonSubmit }}</ui-btn> <ui-btn color="success" type="submit">{{ $strings.ButtonSubmit }}</ui-btn>
@ -212,19 +212,19 @@ export default {
}, },
unlinkOpenID() { unlinkOpenID() {
const payload = { const payload = {
message: 'Are you sure you want to unlink this user from OpenID?', message: this.$strings.MessageConfirmUnlinkOpenId,
callback: (confirmed) => { callback: (confirmed) => {
if (confirmed) { if (confirmed) {
this.unlinkingFromOpenID = true this.unlinkingFromOpenID = true
this.$axios this.$axios
.$patch(`/api/users/${this.account.id}/openid-unlink`) .$patch(`/api/users/${this.account.id}/openid-unlink`)
.then(() => { .then(() => {
this.$toast.success('User unlinked from OpenID') this.$toast.success(this.$strings.ToastUnlinkOpenIdSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to unlink user from OpenID', error) console.error('Failed to unlink user from OpenID', error)
this.$toast.error('Failed to unlink user from OpenID') this.$toast.error(this.$strings.ToastUnlinkOpenIdFailed)
}) })
.finally(() => { .finally(() => {
this.unlinkingFromOpenID = false this.unlinkingFromOpenID = false
@ -265,15 +265,15 @@ export default {
}, },
submitForm() { submitForm() {
if (!this.newUser.username) { if (!this.newUser.username) {
this.$toast.error('Enter a username') this.$toast.error(this.$strings.ToastNewUserUsernameError)
return return
} }
if (!this.newUser.permissions.accessAllLibraries && !this.newUser.librariesAccessible.length) { if (!this.newUser.permissions.accessAllLibraries && !this.newUser.librariesAccessible.length) {
this.$toast.error('Must select at least one library') this.$toast.error(this.$strings.ToastNewUserLibraryError)
return return
} }
if (!this.newUser.permissions.accessAllTags && !this.newUser.itemTagsSelected.length) { if (!this.newUser.permissions.accessAllTags && !this.newUser.itemTagsSelected.length) {
this.$toast.error('Must select at least one tag') this.$toast.error(this.$strings.ToastNewUserTagError)
return return
} }
@ -313,12 +313,12 @@ export default {
this.processing = false this.processing = false
console.error('Failed to update account', error) console.error('Failed to update account', error)
var errMsg = error.response ? error.response.data || '' : '' var errMsg = error.response ? error.response.data || '' : ''
this.$toast.error(errMsg || 'Failed to update account') this.$toast.error(errMsg || this.$strings.ToastFailedToUpdateAccount)
}) })
}, },
submitCreateAccount() { submitCreateAccount() {
if (!this.newUser.password) { if (!this.newUser.password) {
this.$toast.error('Must have a password, only root user can have an empty password') this.$toast.error(this.$strings.ToastNewUserPasswordError)
return return
} }
@ -330,8 +330,9 @@ export default {
this.processing = false this.processing = false
if (data.error) { if (data.error) {
this.$toast.error(`Failed to create account: ${data.error}`) this.$toast.error(`Failed to create account: ${data.error}`)
this.$toast.error(this.$strings.ToastNewUserCreatedFailed.replace('{0}', data.error))
} else { } else {
this.$toast.success('New account created') this.$toast.success(this.$strings.ToastNewUserCreatedSuccess)
this.show = false this.show = false
} }
}) })

View file

@ -94,6 +94,7 @@
"ButtonStats": "Stats", "ButtonStats": "Stats",
"ButtonSubmit": "Submit", "ButtonSubmit": "Submit",
"ButtonTest": "Test", "ButtonTest": "Test",
"ButtonUnlinkOpedId": "Unlink OpenID",
"ButtonUpload": "Upload", "ButtonUpload": "Upload",
"ButtonUploadBackup": "Upload Backup", "ButtonUploadBackup": "Upload Backup",
"ButtonUploadCover": "Upload Cover", "ButtonUploadCover": "Upload Cover",
@ -673,6 +674,7 @@
"MessageConfirmRenameTagMergeNote": "Note: This tag already exists so they will be merged.", "MessageConfirmRenameTagMergeNote": "Note: This tag already exists so they will be merged.",
"MessageConfirmRenameTagWarning": "Warning! A similar tag with a different casing already exists \"{0}\".", "MessageConfirmRenameTagWarning": "Warning! A similar tag with a different casing already exists \"{0}\".",
"MessageConfirmSendEbookToDevice": "Are you sure you want to send {0} ebook \"{1}\" to device \"{2}\"?", "MessageConfirmSendEbookToDevice": "Are you sure you want to send {0} ebook \"{1}\" to device \"{2}\"?",
"MessageConfirmUnlinkOpenId": "Are you sure you want to unlink this user from OpenID?",
"MessageDownloadingEpisode": "Downloading episode", "MessageDownloadingEpisode": "Downloading episode",
"MessageDragFilesIntoTrackOrder": "Drag files into correct track order", "MessageDragFilesIntoTrackOrder": "Drag files into correct track order",
"MessageEmbedFailed": "Embed Failed!", "MessageEmbedFailed": "Embed Failed!",
@ -833,6 +835,7 @@
"ToastEpisodeDownloadQueueClearFailed": "Failed to clear queue", "ToastEpisodeDownloadQueueClearFailed": "Failed to clear queue",
"ToastEpisodeDownloadQueueClearSuccess": "Episode download queue cleared", "ToastEpisodeDownloadQueueClearSuccess": "Episode download queue cleared",
"ToastFailedToLoadData": "Failed to load data", "ToastFailedToLoadData": "Failed to load data",
"ToastFailedToUpdateAccount": "Failed to update account",
"ToastItemCoverUpdateFailed": "Failed to update item cover", "ToastItemCoverUpdateFailed": "Failed to update item cover",
"ToastItemCoverUpdateSuccess": "Item cover updated", "ToastItemCoverUpdateSuccess": "Item cover updated",
"ToastItemDeletedFailed": "Failed to delete item", "ToastItemDeletedFailed": "Failed to delete item",
@ -852,6 +855,12 @@
"ToastLibraryScanStarted": "Library scan started", "ToastLibraryScanStarted": "Library scan started",
"ToastLibraryUpdateFailed": "Failed to update library", "ToastLibraryUpdateFailed": "Failed to update library",
"ToastLibraryUpdateSuccess": "Library \"{0}\" updated", "ToastLibraryUpdateSuccess": "Library \"{0}\" updated",
"ToastNewUserCreatedFailed": "Failed to create account: \"{0}\"",
"ToastNewUserCreatedSuccess": "New account created",
"ToastNewUserLibraryError": "Must select at least one library",
"ToastNewUserPasswordError": "Must have a password, only root user can have an empty password",
"ToastNewUserTagError": "Must select at least one tag",
"ToastNewUserUsernameError": "Enter a username",
"ToastPlaylistCreateFailed": "Failed to create playlist", "ToastPlaylistCreateFailed": "Failed to create playlist",
"ToastPlaylistCreateSuccess": "Playlist created", "ToastPlaylistCreateSuccess": "Playlist created",
"ToastPlaylistRemoveFailed": "Failed to remove playlist", "ToastPlaylistRemoveFailed": "Failed to remove playlist",
@ -882,6 +891,8 @@
"ToastSortingPrefixesEmptyError": "Must have at least 1 sorting prefix", "ToastSortingPrefixesEmptyError": "Must have at least 1 sorting prefix",
"ToastSortingPrefixesUpdateFailed": "Failed to update sorting prefixes", "ToastSortingPrefixesUpdateFailed": "Failed to update sorting prefixes",
"ToastSortingPrefixesUpdateSuccess": "Sorting prefixes updated ({0} items)", "ToastSortingPrefixesUpdateSuccess": "Sorting prefixes updated ({0} items)",
"ToastUnlinkOpenIdFailed": "Failed to unlink user from OpenID",
"ToastUnlinkOpenIdSuccess": "User unlinked from OpenID",
"ToastUserDeleteFailed": "Failed to delete user", "ToastUserDeleteFailed": "Failed to delete user",
"ToastUserDeleteSuccess": "User deleted" "ToastUserDeleteSuccess": "User deleted"
} }