diff --git a/service/database/db-users.go b/service/database/db-users.go index 003e635..2c590ee 100644 --- a/service/database/db-users.go +++ b/service/database/db-users.go @@ -58,10 +58,13 @@ func (db *appdbimpl) CreateUser(name string) (string, error) { return "", errors.New("username already exists") } + // create new user id uid, err := uuid.NewV4() if err != nil { return "", err } + + // insert the new user into the database _, err = db.c.Exec(`INSERT INTO "users" ("uid", "name") VALUES (?, ?)`, uid.String(), name) return uid.String(), err } diff --git a/webui/src/components/UserCard.vue b/webui/src/components/UserCard.vue index 9c8227e..cb6c610 100644 --- a/webui/src/components/UserCard.vue +++ b/webui/src/components/UserCard.vue @@ -75,6 +75,7 @@ export default { updateUsername() { this.$axios.put("/users/" + this.$currentSession() + "/username", { name: this.newUsername }) .then(response => { + if (response == null) return; // the interceptors returns null if something goes bad this.show_username_form = false this.$emit('updateInfo') this.username = this.newUsername