From dae9ab94a4fac1a72bedd773474806b79d5e6477 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 6 Jul 2022 16:42:38 +0100 Subject: [PATCH] Fixing issue which can block accessing platform - if error scenario occurs but admin user partially created. --- packages/worker/src/api/controllers/global/users.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/worker/src/api/controllers/global/users.ts b/packages/worker/src/api/controllers/global/users.ts index f84a44098a..5e3b3accb4 100644 --- a/packages/worker/src/api/controllers/global/users.ts +++ b/packages/worker/src/api/controllers/global/users.ts @@ -60,11 +60,13 @@ export const adminUser = async (ctx: any) => { tenantId, } try { + // always bust checklist beforehand, if an error occurs but can proceed, don't get + // stuck in a cycle + await cache.bustCache(cache.CacheKeys.CHECKLIST) const finalUser = await users.save(user, { hashPassword, requirePassword, }) - await cache.bustCache(cache.CacheKeys.CHECKLIST) // events let account: CloudAccount | undefined