mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Update:Guest user accounts cannot change the account password #537
This commit is contained in:
parent
729fdd5c9f
commit
049ae73d74
@ -15,8 +15,8 @@
|
||||
|
||||
<div class="w-full h-px bg-primary my-4" />
|
||||
|
||||
<p class="mb-4 text-lg">Change Password</p>
|
||||
<form @submit.prevent="submitChangePassword">
|
||||
<p v-if="!isGuest" class="mb-4 text-lg">Change Password</p>
|
||||
<form v-if="!isGuest" @submit.prevent="submitChangePassword">
|
||||
<ui-text-input-with-label v-model="password" :disabled="changingPassword" type="password" label="Password" class="my-2" />
|
||||
<ui-text-input-with-label v-model="newPassword" :disabled="changingPassword" type="password" label="New Password" class="my-2" />
|
||||
<ui-text-input-with-label v-model="confirmPassword" :disabled="changingPassword" type="password" label="Confirm Password" class="my-2" />
|
||||
@ -60,6 +60,9 @@ export default {
|
||||
},
|
||||
isRoot() {
|
||||
return this.usertype === 'root'
|
||||
},
|
||||
isGuest() {
|
||||
return this.usertype === 'guest'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -133,6 +133,10 @@ class MeController {
|
||||
|
||||
// PATCH: api/me/password
|
||||
updatePassword(req, res) {
|
||||
if (req.user.isGuest) {
|
||||
Logger.error(`[MeController] Guest user attempted to change password`, req.user.username)
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
this.auth.userChangePassword(req, res)
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,9 @@ class User {
|
||||
get isAdmin() {
|
||||
return this.type === 'admin'
|
||||
}
|
||||
get isGuest() {
|
||||
return this.type === 'guest'
|
||||
}
|
||||
get isAdminOrUp() {
|
||||
return this.isAdmin || this.isRoot
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user