summary refs log tree commit diff
path: root/src/api/routes/auth
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/auth')
-rw-r--r--src/api/routes/auth/login.ts23
-rw-r--r--src/api/routes/auth/mfa/totp.ts5
-rw-r--r--src/api/routes/auth/mfa/webauthn.ts5
3 files changed, 23 insertions, 10 deletions
diff --git a/src/api/routes/auth/login.ts b/src/api/routes/auth/login.ts

index a2100333..d2384337 100644 --- a/src/api/routes/auth/login.ts +++ b/src/api/routes/auth/login.ts
@@ -139,7 +139,9 @@ router.post( ticket: ticket, mfa: true, sms: false, // TODO - token: null, + totp: true, + backup: true, + user_id: user.id, }); } @@ -172,7 +174,9 @@ router.post( ticket: ticket, mfa: true, sms: false, // TODO - token: null, + totp: true, + backup: true, + user_id: user.id, webauthn: challenge, }); } @@ -202,7 +206,13 @@ router.post( // Discord header is just the user id as string, which is not possible with npm-jsonwebtoken package // https://user-images.githubusercontent.com/6506416/81051916-dd8c9900-8ec2-11ea-8794-daf12d6f31f0.png - res.json({ token, settings: { ...user.settings, index: undefined } }); + res.json({ + token, + settings: { + locale: user.settings.locale, + theme: user.settings.theme, + }, + }); }, ); @@ -211,15 +221,12 @@ router.post( * @argument { login: "email@gmail.com", password: "cleartextpassword", undelete: false, captcha_key: null, login_source: null, gift_code_sku_id: null, } * MFA required: - * @returns {"token": null, "mfa": true, "sms": true, "ticket": "SOME TICKET JWT TOKEN"} - - * WebAuthn MFA required: - * @returns {"token": null, "mfa": true, "webauthn": true, "sms": true, "ticket": "SOME TICKET JWT TOKEN"} + * @returns {"mfa": true, "sms": boolean, "totp": boolean, "backup": true, "ticket": "SOME TICKET JWT TOKEN", "user_id": "USER ID", "webauthn": "WEBAUTHN DATA or null"} * Captcha required: * @returns {"captcha_key": ["captcha-required"], "captcha_sitekey": null, "captcha_service": "recaptcha"} * Sucess: - * @returns {"token": "USERTOKEN", "settings": {"locale": "en", "theme": "dark"}} + * @returns {"token": "USERTOKEN", "user_id": "USER ID", "settings": {"locale": "en-US", "theme": "dark"}} */ diff --git a/src/api/routes/auth/mfa/totp.ts b/src/api/routes/auth/mfa/totp.ts
index 4df408f9..20ecd7a1 100644 --- a/src/api/routes/auth/mfa/totp.ts +++ b/src/api/routes/auth/mfa/totp.ts
@@ -73,7 +73,10 @@ router.post( return res.json({ token: await generateToken(user.id), - settings: { ...user.settings, index: undefined }, + settings: { + locale: user.settings.locale, + theme: user.settings.theme, + }, }); }, ); diff --git a/src/api/routes/auth/mfa/webauthn.ts b/src/api/routes/auth/mfa/webauthn.ts
index b58d2944..687fdcd8 100644 --- a/src/api/routes/auth/mfa/webauthn.ts +++ b/src/api/routes/auth/mfa/webauthn.ts
@@ -114,7 +114,10 @@ router.post( return res.json({ token: await generateToken(user.id), - user_settings: user.settings, + user_settings: { + locale: user.settings.locale, + theme: user.settings.theme, + }, }); }, );