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

View File

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