diff --git a/packages/builder/src/components/settings/UserRow.svelte b/packages/builder/src/components/settings/UserRow.svelte
index 4602ad1709..1d7059552b 100644
--- a/packages/builder/src/components/settings/UserRow.svelte
+++ b/packages/builder/src/components/settings/UserRow.svelte
@@ -9,7 +9,7 @@
row.doc)
}
-exports.create = async function(ctx) {
+exports.create = async function (ctx) {
const database = new CouchDB(ctx.user.instanceId)
const appId = (await database.get("_design/database")).metadata.applicationId
const { username, password, name, accessLevelId } = ctx.request.body
@@ -63,11 +63,13 @@ exports.create = async function(ctx) {
}
}
-exports.update = async function(ctx) {
+exports.update = async function (ctx) {
const db = new CouchDB(ctx.user.instanceId)
const user = ctx.request.body
+ const dbUser = db.get(ctx.request.body._id)
+ const newData = { ...dbUser, ...user }
- const response = await db.put(user)
+ const response = await db.put(newData)
user._rev = response.rev
ctx.status = 200
@@ -75,14 +77,14 @@ exports.update = async function(ctx) {
ctx.body = response
}
-exports.destroy = async function(ctx) {
+exports.destroy = async function (ctx) {
const database = new CouchDB(ctx.user.instanceId)
await database.destroy(getUserId(ctx.params.username))
ctx.message = `User ${ctx.params.username} deleted.`
ctx.status = 200
}
-exports.find = async function(ctx) {
+exports.find = async function (ctx) {
const database = new CouchDB(ctx.user.instanceId)
const user = await database.get(getUserId(ctx.params.username))
ctx.body = {