From ef394bab64cf5d76496c56c3e19c0332417443c4 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Fri, 13 Oct 2023 13:04:24 -0500 Subject: [PATCH] Updated user function --- netlify/functions/users/users.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlify/functions/users/users.ts b/netlify/functions/users/users.ts index f3497db..1c864d8 100644 --- a/netlify/functions/users/users.ts +++ b/netlify/functions/users/users.ts @@ -8,7 +8,7 @@ export const handler: Handler = async (event: HandlerEvent, context: HandlerCont const dbKey = event.queryStringParameters.shareKey; const password = event.queryStringParameters.password; - if (!dbKey) { + if (!dbKey || !password) { throw new Error('No share key provided'); } try { @@ -37,7 +37,7 @@ export const handler: Handler = async (event: HandlerEvent, context: HandlerCont if (response.status == 200) { const response2 = await axios.put( baseurl + '_users', - {_id: 'org.couchdb.user:' + dbKey, name: dbKey, password: password, roles: []}, + {_id: 'org.couchdb.user:' + dbKey, name: dbKey, password: password, roles: [], type: 'user'}, { headers: { 'Authorization': 'Basic ' + authToken,