enables optional api key auth
This commit is contained in:
20
src/auth/baseAPIKeyFields.js
Normal file
20
src/auth/baseAPIKeyFields.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const validations = require('../fields/validations');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
name: 'enableAPIKey',
|
||||
label: 'Enable API key for this user',
|
||||
type: 'checkbox',
|
||||
defaultValue: false,
|
||||
validate: validations.checkbox,
|
||||
},
|
||||
{
|
||||
name: 'apiKey',
|
||||
type: 'text',
|
||||
label: 'User API Key',
|
||||
condition: (_, siblings) => {
|
||||
return siblings.enableAPIKey && siblings.enableAPIKey.value;
|
||||
},
|
||||
validate: validations.text,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user