mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 14:16:15 +01:00
Fix username changing only on frontend
This commit is contained in:
parent
d7f35991df
commit
1873db9006
2 changed files with 4 additions and 0 deletions
|
@ -58,10 +58,13 @@ func (db *appdbimpl) CreateUser(name string) (string, error) {
|
||||||
return "", errors.New("username already exists")
|
return "", errors.New("username already exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create new user id
|
||||||
uid, err := uuid.NewV4()
|
uid, err := uuid.NewV4()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// insert the new user into the database
|
||||||
_, err = db.c.Exec(`INSERT INTO "users" ("uid", "name") VALUES (?, ?)`, uid.String(), name)
|
_, err = db.c.Exec(`INSERT INTO "users" ("uid", "name") VALUES (?, ?)`, uid.String(), name)
|
||||||
return uid.String(), err
|
return uid.String(), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ export default {
|
||||||
updateUsername() {
|
updateUsername() {
|
||||||
this.$axios.put("/users/" + this.$currentSession() + "/username", { name: this.newUsername })
|
this.$axios.put("/users/" + this.$currentSession() + "/username", { name: this.newUsername })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
if (response == null) return; // the interceptors returns null if something goes bad
|
||||||
this.show_username_form = false
|
this.show_username_form = false
|
||||||
this.$emit('updateInfo')
|
this.$emit('updateInfo')
|
||||||
this.username = this.newUsername
|
this.username = this.newUsername
|
||||||
|
|
Loading…
Reference in a new issue