Catch login errors
This commit is contained in:
parent
fd4b1235d4
commit
1686ec01be
@ -14,15 +14,17 @@ export const RegisterMW : MiddlewareFunction = async (request, response, data, r
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = await getKeyCloakClient();
|
|
||||||
const userRequest = {
|
const userRequest = {
|
||||||
username: data.json.username,
|
username: data.json.username,
|
||||||
|
enabled: true,
|
||||||
groups: Config.TARGET_GROUPS,
|
groups: Config.TARGET_GROUPS,
|
||||||
realm: Config.TARGET_REALM
|
realm: Config.TARGET_REALM
|
||||||
};
|
};
|
||||||
|
|
||||||
log.debug('Creating user:', userRequest);
|
|
||||||
try {
|
try {
|
||||||
|
const client = await getKeyCloakClient();
|
||||||
|
|
||||||
|
log.debug('Creating user:', userRequest);
|
||||||
const result = await client.users.create(userRequest);
|
const result = await client.users.create(userRequest);
|
||||||
log.debug('Created user:', result.id);
|
log.debug('Created user:', result.id);
|
||||||
const user = await client.users.findOne({ realm: userRequest.realm, id: result.id});
|
const user = await client.users.findOne({ realm: userRequest.realm, id: result.id});
|
||||||
|
Loading…
Reference in New Issue
Block a user