fix: separate whitelist and no new user
This commit is contained in:
parent
9f4b54f53b
commit
31ee293b7a
5 changed files with 12 additions and 3 deletions
|
@ -180,11 +180,16 @@ router.get('(.*)', async (ctx) => {
|
|||
|
||||
async function login(ctx: Context, user: Record<string, unknown>, host: string, token: string) {
|
||||
const isNewcomer = !(await getUser(user.username as string, host));
|
||||
if (isNewcomer && config.whitelist.enabled && !config.whitelist.instances.includes(host)) {
|
||||
if (isNewcomer && config.noNewUserAllowed) {
|
||||
await die(ctx, 'noNewUserAllowed', 403);
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.whitelist.enabled && !config.whitelist.instances.includes(host)) {
|
||||
await die(ctx, 'notWhitelisted', 403);
|
||||
return;
|
||||
}
|
||||
|
||||
await upsertUser(user.username as string, host, token);
|
||||
const u = await getUser(user.username as string, host);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue