Pass the credentials to the endpoint
This commit is contained in:
parent
e602fb1bd2
commit
c63d1ea58b
1 changed files with 5 additions and 5 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -45,13 +45,13 @@ async function init() {
|
||||||
// Setup authentication
|
// Setup authentication
|
||||||
server.register(basic);
|
server.register(basic);
|
||||||
server.auth.strategy(`simple`, `basic`, {
|
server.auth.strategy(`simple`, `basic`, {
|
||||||
async validate(request: Request, user: string, pass: string, h: ResponseToolkit) {
|
async validate(request: Request, user: string, password: string, h: ResponseToolkit) {
|
||||||
|
|
||||||
// Are we attempting to authenticate, then use the auth password
|
// Are we attempting to authenticate, then use the auth password
|
||||||
if (request.path.startsWith(`/discord/auth`)) {
|
if (request.path.startsWith(`/discord/auth`)) {
|
||||||
return {
|
return {
|
||||||
isValid: config.discord.auth_password === pass,
|
isValid: config.discord.auth_password === password,
|
||||||
credentials: { pass },
|
credentials: { user, password },
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -61,8 +61,8 @@ async function init() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isValid: config.guilds[user].password === pass,
|
isValid: config.guilds[user].password === password,
|
||||||
credentials: { user }
|
credentials: { user, password }
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
allowEmptyUsername: true,
|
allowEmptyUsername: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue