fix: check for username before allowing password change (#2239)

This commit is contained in:
Vlad Stan 2024-02-06 11:48:13 +02:00 committed by GitHub
parent 4f45781319
commit 59968e38d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,6 +54,13 @@ new Vue({
}
},
updatePassword: async function () {
if (!this.user.username) {
this.$q.notify({
type: 'warning',
message: 'Please set a username first.'
})
return
}
try {
const {data} = await LNbits.api.request(
'PUT',
@ -61,6 +68,7 @@ new Vue({
null,
{
user_id: this.user.id,
username: this.user.username,
password_old: this.passwordData.oldPassword,
password: this.passwordData.newPassword,
password_repeat: this.passwordData.newPasswordRepeat
@ -77,6 +85,13 @@ new Vue({
}
},
showChangePassword: function () {
if (!this.user.username) {
this.$q.notify({
type: 'warning',
message: 'Please set a username first.'
})
return
}
this.passwordData = {
show: true,
oldPassword: null,