summary refs log tree commit diff
path: root/src/routes/auth
diff options
context:
space:
mode:
authorDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-23 13:43:38 -0500
committerDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-23 13:43:38 -0500
commit28424ed95030e700f9aa8d6f4305da045f260a39 (patch)
tree29c5d85351363f7f189a61e2da52c214e597c0dd /src/routes/auth
parentMerge branch 'fosscord-master' (diff)
downloadserver-28424ed95030e700f9aa8d6f4305da045f260a39.tar.xz
Fix: No more type casting required, rather take the gernics
Diffstat (limited to 'src/routes/auth')
-rw-r--r--src/routes/auth/login.ts4
-rw-r--r--src/routes/auth/register.ts2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/routes/auth/login.ts b/src/routes/auth/login.ts

index 275f78c6..1938b794 100644 --- a/src/routes/auth/login.ts +++ b/src/routes/auth/login.ts
@@ -27,7 +27,7 @@ router.post( // TODO: Rewrite this to have the proper config syntax on the new method - const config = Config.apiConfig.getAll() as Config.DefaultOptions; + const config = Config.apiConfig.getAll(); if (config.login.requireCaptcha && config.security.captcha.enabled) { if (!captcha_key) { @@ -71,7 +71,7 @@ export async function generateToken(id: string) { return new Promise((res, rej) => { jwt.sign( { id: id, iat }, - (Config.apiConfig.getAll() as Config.DefaultOptions).security.jwtSecret, + Config.apiConfig.getAll().security.jwtSecret, { algorithm, }, diff --git a/src/routes/auth/register.ts b/src/routes/auth/register.ts
index eeef961e..98fa768c 100644 --- a/src/routes/auth/register.ts +++ b/src/routes/auth/register.ts
@@ -52,7 +52,7 @@ router.post( let discriminator = ""; // get register Config - const { register, security } = Config.apiConfig.getAll() as Config.DefaultOptions; + const { register, security } = Config.apiConfig.getAll(); // check if registration is allowed if (!register.allowNewRegistration) {