From 586b25a54c6ec8bd134bce05c480cd429e47e252 Mon Sep 17 00:00:00 2001 From: Dan Ribbens Date: Mon, 13 Feb 2023 22:33:01 -0500 Subject: [PATCH] fix: #2077 useAPIKey UI missing with disableLocalStrategy (#2084) --- .../views/collections/Edit/Auth/index.tsx | 78 ++++++++++--------- test/auth/config.ts | 8 ++ 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/src/admin/components/views/collections/Edit/Auth/index.tsx b/src/admin/components/views/collections/Edit/Auth/index.tsx index 48d668dc50..dee713a2d3 100644 --- a/src/admin/components/views/collections/Edit/Auth/index.tsx +++ b/src/admin/components/views/collections/Edit/Auth/index.tsx @@ -67,56 +67,60 @@ const Auth: React.FC = (props) => { } }, [modified]); - if (collection.auth.disableLocalStrategy) { + if (collection.auth.disableLocalStrategy && !collection.auth.useAPIKey) { return null; } return (
- - {(changingPassword || requirePassword) && ( -
- + - - {!requirePassword && ( + {(changingPassword || requirePassword) && ( +
+ + + {!requirePassword && ( + + )} +
+ )} + {(!changingPassword && !requirePassword) && ( + + )} + {operation === 'update' && ( )} -
- )} - {(!changingPassword && !requirePassword) && ( - - )} - {operation === 'update' && ( - + )} {useAPIKey && (
diff --git a/test/auth/config.ts b/test/auth/config.ts index ee4f5a63b9..2d0f366b46 100644 --- a/test/auth/config.ts +++ b/test/auth/config.ts @@ -36,6 +36,14 @@ export default buildConfig({ }, ], }, + { + slug: 'api-keys', + auth: { + disableLocalStrategy: true, + useAPIKey: true, + }, + fields: [], + }, ], onInit: async (payload) => { await payload.create({