This commit is contained in:
Elias Schneider
2024-10-14 17:15:42 +02:00
4 changed files with 22 additions and 208 deletions

View File

@@ -81,7 +81,11 @@ export class DiscordProvider implements OAuthProvider<DiscordToken> {
if (guild) {
await this.checkLimitedGuild(token, guild);
}
const limitedUsers = this.config.get("oauth.discord-limitedUsers");
if (limitedUsers) {
await this.checkLimitedUsers(user, limitedUsers);
}
return {
provider: "discord",
providerId: user.id,
@@ -107,6 +111,12 @@ export class DiscordProvider implements OAuthProvider<DiscordToken> {
throw new ErrorPageException("user_not_allowed");
}
}
async checkLimitedUsers(user: DiscordUser, userIds: string) {
if (!userIds.split(",").includes(user.id)) {
throw new ErrorPageException("user_not_allowed");
}
}
}
export interface DiscordToken {