diff --git a/locales/af/auth.json b/locales/af/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/af/auth.json
+++ b/locales/af/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/ar/auth.json b/locales/ar/auth.json
index c38c930a..d60a0b35 100644
--- a/locales/ar/auth.json
+++ b/locales/ar/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "البريد الإلكتروني أو الهاتف غير موجود",
- "INVALID_PASSWORD": "كلمة المرور غير صالحة"
+ "INVALID_PASSWORD": "كلمة المرور غير صالحة",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "تم تعطيل تسجيل المستخدم الجديد",
diff --git a/locales/be/auth.json b/locales/be/auth.json
index 3c4d3bed..b9ac5e2e 100644
--- a/locales/be/auth.json
+++ b/locales/be/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Дадзены адрас электроннай пошты ці тэлефон не знойдзены",
- "INVALID_PASSWORD": "Няправільны пароль"
+ "INVALID_PASSWORD": "Няправільны пароль",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Рэгістрацыя новага карыстальніка адключана",
diff --git a/locales/bg/auth.json b/locales/bg/auth.json
index 7c6a0b11..1dfd3568 100644
--- a/locales/bg/auth.json
+++ b/locales/bg/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Невалиден имейл адрес или телефонен номер",
- "INVALID_PASSWORD": "Невалидна парола"
+ "INVALID_PASSWORD": "Невалидна парола",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Регистрацията на нов потребител е деактивирана",
diff --git a/locales/ca/auth.json b/locales/ca/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/ca/auth.json
+++ b/locales/ca/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/cs/auth.json b/locales/cs/auth.json
index 74468440..70acc5ba 100644
--- a/locales/cs/auth.json
+++ b/locales/cs/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail nebo telefon nenalezen",
- "INVALID_PASSWORD": "Neplatné heslo"
+ "INVALID_PASSWORD": "Neplatné heslo",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registrace nového uživatele je zakázána",
diff --git a/locales/da/auth.json b/locales/da/auth.json
index 853b2148..87465404 100644
--- a/locales/da/auth.json
+++ b/locales/da/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mail eller telefon ikke fundet",
- "INVALID_PASSWORD": "Ugyldig Adgangskode"
+ "INVALID_PASSWORD": "Ugyldig Adgangskode",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Ny brugerregistrering er deaktiveret",
diff --git a/locales/de/auth.json b/locales/de/auth.json
index 6c91695c..3f8c2b26 100644
--- a/locales/de/auth.json
+++ b/locales/de/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail oder Telefonnummer nicht gefunden",
- "INVALID_PASSWORD": "Ungültiges Passwort"
+ "INVALID_PASSWORD": "Ungültiges Passwort",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Die Registrierung ist deaktiviert",
diff --git a/locales/el/auth.json b/locales/el/auth.json
index 40a2c4fe..9315d590 100644
--- a/locales/el/auth.json
+++ b/locales/el/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Το e-mail ή το τηλέφωνο δεν βρέθηκε",
- "INVALID_PASSWORD": "Μη Έγκυρος Κωδικός"
+ "INVALID_PASSWORD": "Μη Έγκυρος Κωδικός",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Η εγγραφή νέου χρήστη είναι απενεργοποιημένη",
diff --git a/locales/en/auth.json b/locales/en/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/en/auth.json
+++ b/locales/en/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/eo/auth.json b/locales/eo/auth.json
index 11107697..2d0f7de9 100644
--- a/locales/eo/auth.json
+++ b/locales/eo/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail aŭ Telefonnumero ne trovis",
- "INVALID_PASSWORD": "Pasfrazo ne validas"
+ "INVALID_PASSWORD": "Pasfrazo ne validas",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Nova uzanta reĝistro estas malebligita",
diff --git a/locales/es/auth.json b/locales/es/auth.json
index 28c21bde..8271c578 100644
--- a/locales/es/auth.json
+++ b/locales/es/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail o teléfono no encontrado",
- "INVALID_PASSWORD": "Contraseña Incorrecta"
+ "INVALID_PASSWORD": "Contraseña Incorrecta",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "El registro de un nuevo usuario no se encuentra habilitado",
diff --git a/locales/fi/auth.json b/locales/fi/auth.json
index 001a7371..ba099f28 100644
--- a/locales/fi/auth.json
+++ b/locales/fi/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Sähköpostia tai puhelinta ei löydy",
- "INVALID_PASSWORD": "Virheellinen Salasana"
+ "INVALID_PASSWORD": "Virheellinen Salasana",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Uuden käyttäjän rekisteröinti pois käytöstä",
diff --git a/locales/fr/auth.json b/locales/fr/auth.json
index 98d5b2e2..eb9eef98 100644
--- a/locales/fr/auth.json
+++ b/locales/fr/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail ou Téléphone introuvable",
- "INVALID_PASSWORD": "Mot de passe invalide"
+ "INVALID_PASSWORD": "Mot de passe invalide",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "L'inscription aux nouveaux utilisateurs est désactivée",
diff --git a/locales/he/auth.json b/locales/he/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/he/auth.json
+++ b/locales/he/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/hi/auth.json b/locales/hi/auth.json
index 679e5bc1..00c7586b 100644
--- a/locales/hi/auth.json
+++ b/locales/hi/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "ईमेल या फ़ोन नहीं मिला",
- "INVALID_PASSWORD": "अमान्य पासवर्ड"
+ "INVALID_PASSWORD": "अमान्य पासवर्ड",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "नया उपयोगकर्ता पंजीकरण अक्षम है",
diff --git a/locales/hr/auth.json b/locales/hr/auth.json
index 3e330168..0f2c8456 100644
--- a/locales/hr/auth.json
+++ b/locales/hr/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Email ili broj mobitela nije pronađen",
- "INVALID_PASSWORD": "Pogrešna lozinka"
+ "INVALID_PASSWORD": "Pogrešna lozinka",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registracija novog korisnika je onemogućena",
diff --git a/locales/hu/auth.json b/locales/hu/auth.json
index 6cbbcf8c..3891ce28 100644
--- a/locales/hu/auth.json
+++ b/locales/hu/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Nincs ilyen E-Mail vagy Telefon",
- "INVALID_PASSWORD": "Érvénytelen jelszó"
+ "INVALID_PASSWORD": "Érvénytelen jelszó",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Új felhasználók regisztrációja nem engedélyezett",
diff --git a/locales/id/auth.json b/locales/id/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/id/auth.json
+++ b/locales/id/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/it/auth.json b/locales/it/auth.json
index 316d55ea..3ba387e9 100644
--- a/locales/it/auth.json
+++ b/locales/it/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail o numero di telefono non trovato",
- "INVALID_PASSWORD": "Password Non Valida"
+ "INVALID_PASSWORD": "Password Non Valida",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "La registrazione di nuovi utenti è disabilitata",
diff --git a/locales/ja/auth.json b/locales/ja/auth.json
index 76d1005e..7a131bb7 100644
--- a/locales/ja/auth.json
+++ b/locales/ja/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "メールまたは電話が見つかりません",
- "INVALID_PASSWORD": "無効なパスワード"
+ "INVALID_PASSWORD": "無効なパスワード",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "新しいユーザー登録は無効です",
diff --git a/locales/ko/auth.json b/locales/ko/auth.json
index f4ed7c0d..7917c821 100644
--- a/locales/ko/auth.json
+++ b/locales/ko/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "이메일 또는 전화번호를 찾을 수 없습니다",
- "INVALID_PASSWORD": "비밀번호가 틀렸습니다"
+ "INVALID_PASSWORD": "비밀번호가 틀렸습니다",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "신규 사용자의 등록이 비활성화되었습니다",
diff --git a/locales/lt/auth.json b/locales/lt/auth.json
index cd1e28a1..0e2f0508 100644
--- a/locales/lt/auth.json
+++ b/locales/lt/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "El. Paštas ar telefonas nerastas",
- "INVALID_PASSWORD": "Neteisingas slaptažodis"
+ "INVALID_PASSWORD": "Neteisingas slaptažodis",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Naujų vartotojų registracija išjungta",
diff --git a/locales/nl/auth.json b/locales/nl/auth.json
index fcf5b8b1..d84fdcea 100644
--- a/locales/nl/auth.json
+++ b/locales/nl/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mailadres of telefoon niet gevonden",
- "INVALID_PASSWORD": "Ongeldig wachtwoord"
+ "INVALID_PASSWORD": "Ongeldig wachtwoord",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registratie voor nieuwe gebruikers is uitgeschakeld",
diff --git a/locales/no/auth.json b/locales/no/auth.json
index 0fe1957d..2c0ea29e 100644
--- a/locales/no/auth.json
+++ b/locales/no/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Fant ikke e-postadresse eller telefon",
- "INVALID_PASSWORD": "Ugyldig passord"
+ "INVALID_PASSWORD": "Ugyldig passord",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Ny brukerregistrering er deaktivert",
diff --git a/locales/pl/auth.json b/locales/pl/auth.json
index fb453044..f62c56db 100644
--- a/locales/pl/auth.json
+++ b/locales/pl/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mail lub telefon nie znaleziony",
- "INVALID_PASSWORD": "Nieprawidłowe hasło"
+ "INVALID_PASSWORD": "Nieprawidłowe hasło",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Rejestracja nowego użytkownika jest wyłączona",
diff --git a/locales/pt/auth.json b/locales/pt/auth.json
index 455b7eda..ee977136 100644
--- a/locales/pt/auth.json
+++ b/locales/pt/auth.json
@@ -1,12 +1,13 @@
{
"login": {
"INVALID_LOGIN": "E-mail ou Telefone não encontrado",
- "INVALID_PASSWORD": "Senha inválida"
+ "INVALID_PASSWORD": "Senha inválida",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registro de novos usuários está desativado",
"INVITE_ONLY": "Você deve ser convidado para registrar",
- "EMAIL_INVALID": "Invalid Email",
+ "EMAIL_INVALID": "E-mail inválido",
"EMAIL_ALREADY_REGISTERED": "E-mail já está registrado",
"DATE_OF_BIRTH_UNDERAGE": "Você precisa ter {{years}} anos ou mais",
"CONSENT_REQUIRED": "Você precisa aceitar os Termos de Serviço e a Política de Privacidade.",
diff --git a/locales/ro/auth.json b/locales/ro/auth.json
index b081689a..929e2596 100644
--- a/locales/ro/auth.json
+++ b/locales/ro/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mailul sau telefonul nu au fost găsite",
- "INVALID_PASSWORD": "Parolă nevalidă"
+ "INVALID_PASSWORD": "Parolă nevalidă",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Înregistrarea noului utilizator este dezactivată",
diff --git a/locales/ru/auth.json b/locales/ru/auth.json
index a586c697..b63ac34f 100644
--- a/locales/ru/auth.json
+++ b/locales/ru/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Данный адрес электронной почты или телефон не найден",
- "INVALID_PASSWORD": "Неверный пароль"
+ "INVALID_PASSWORD": "Неверный пароль",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Регистрация нового пользователя отключена",
diff --git a/locales/sk/auth.json b/locales/sk/auth.json
index bcf8e680..241d71e9 100644
--- a/locales/sk/auth.json
+++ b/locales/sk/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mail alebo telefón nebol nájdený",
- "INVALID_PASSWORD": "Neplatné Heslo"
+ "INVALID_PASSWORD": "Neplatné Heslo",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registrácia nového používateľa je zakázaná",
diff --git a/locales/sr/auth.json b/locales/sr/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/sr/auth.json
+++ b/locales/sr/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/sv/auth.json b/locales/sv/auth.json
index 346a8efb..c94b0810 100644
--- a/locales/sv/auth.json
+++ b/locales/sv/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-post eller telefon hittades inte",
- "INVALID_PASSWORD": "Ogiltigt lösenord"
+ "INVALID_PASSWORD": "Ogiltigt lösenord",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Registrering av nya användare är inaktiverat",
diff --git a/locales/tr/auth.json b/locales/tr/auth.json
index 0b2693b7..80c06600 100644
--- a/locales/tr/auth.json
+++ b/locales/tr/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "Eposta veya Telefon Numarası bulunamadı",
- "INVALID_PASSWORD": "Geçersiz Şifre"
+ "INVALID_PASSWORD": "Geçersiz Şifre",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Yeni kullanıcı alımı devre dışı bırakıldı",
diff --git a/locales/uk/auth.json b/locales/uk/auth.json
index c5be32df..76c4e500 100644
--- a/locales/uk/auth.json
+++ b/locales/uk/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail або телефон не знайдено",
- "INVALID_PASSWORD": "Невірний пароль"
+ "INVALID_PASSWORD": "Невірний пароль",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Реєстрація нового користувача вимкнута",
diff --git a/locales/ur/auth.json b/locales/ur/auth.json
index bcf6fca5..e19547a0 100644
--- a/locales/ur/auth.json
+++ b/locales/ur/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-Mail or Phone not found",
- "INVALID_PASSWORD": "Invalid Password"
+ "INVALID_PASSWORD": "Invalid Password",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "New user registration is disabled",
diff --git a/locales/vi/auth.json b/locales/vi/auth.json
index acc678cf..b2f59d44 100644
--- a/locales/vi/auth.json
+++ b/locales/vi/auth.json
@@ -1,7 +1,8 @@
{
"login": {
"INVALID_LOGIN": "E-mail hoặc số điện thoại không tồn tại",
- "INVALID_PASSWORD": "Sai mật khẩu"
+ "INVALID_PASSWORD": "Sai mật khẩu",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
"REGISTRATION_DISABLED": "Hệ thống hiện không cho phép tài khoản mới",
diff --git a/locales/zh/auth.json b/locales/zh/auth.json
index db5f1eb4..b802ba22 100644
--- a/locales/zh/auth.json
+++ b/locales/zh/auth.json
@@ -1,15 +1,16 @@
{
"login": {
- "INVALID_LOGIN": "找不到电子邮件或电话",
- "INVALID_PASSWORD": "无效密码"
+ "INVALID_LOGIN": "找不到電子郵件或電話",
+ "INVALID_PASSWORD": "無效的密碼",
+ "ACCOUNT_DISABLED": "This account is disabled"
},
"register": {
- "REGISTRATION_DISABLED": "新用户注册已禁用",
- "INVITE_ONLY": "您必须被邀请注册",
- "EMAIL_INVALID": "Invalid Email",
- "EMAIL_ALREADY_REGISTERED": "电子邮件已注册",
- "DATE_OF_BIRTH_UNDERAGE": "您需要有 {{years}} 岁以上",
- "CONSENT_REQUIRED": "您必须同意服务条款和隐私政策。",
- "USERNAME_TOO_MANY_USERS": "用户名太多,请尝试另一个"
+ "REGISTRATION_DISABLED": "新用戶註冊已禁用",
+ "INVITE_ONLY": "必須邀請您才能註冊",
+ "EMAIL_INVALID": "無效電子郵件",
+ "EMAIL_ALREADY_REGISTERED": "該電郵地址已註冊",
+ "DATE_OF_BIRTH_UNDERAGE": "您必須年滿 {{years}} 歲",
+ "CONSENT_REQUIRED": "您必須同意服務條款和隱私政策。",
+ "USERNAME_TOO_MANY_USERS": "此用戶名太多,請嘗試使用其他用戶名"
}
}
diff --git a/src/routes/auth/login.ts b/src/routes/auth/login.ts
index d7c6e833..8d1a8df3 100644
--- a/src/routes/auth/login.ts
+++ b/src/routes/auth/login.ts
@@ -9,7 +9,8 @@ import RateLimit from "../../middlewares/RateLimit";
const router: Router = Router();
export default router;
-// TODO: check if user is deleted/restricted
+// TODO: check if user is deleted --> prohibit login
+
router.post(
"/",
RateLimit({ count: 5, window: 60, onlyIp: true }),
@@ -22,7 +23,7 @@ router.post(
$gift_code_sku_id: String
}),
async (req: Request, res: Response) => {
- const { login, password, captcha_key } = req.body;
+ const { login, password, captcha_key, undelete } = req.body;
const email = adjustEmail(login);
const query: any[] = [{ phone: login }];
if (email) query.push({ email });
@@ -62,6 +63,13 @@ router.post(
throw FieldErrors({ login: { message: req.t("auth:login.INVALID_LOGIN"), code: "INVALID_LOGIN" } });
});
+ if (user.disabled && undelete) {
+ // undelete refers to un'disable' here
+ await UserModel.updateOne({ id: req.user_id }, { disabled: false }).exec();
+ } else if (user.disabled) {
+ return res.status(400).json({ message: req.t("auth:login.ACCOUNT_DISABLED"), code: 20013 });
+ }
+
// the salt is saved in the password refer to bcrypt docs
const same_password = await bcrypt.compare(password, user.user_data.hash || "");
if (!same_password) {
@@ -100,14 +108,14 @@ export async function generateToken(id: string) {
/**
* POST /auth/login
* @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"}
-
+
* Captcha required:
* @returns {"captcha_key": ["captcha-required"], "captcha_sitekey": null, "captcha_service": "recaptcha"}
-
+
* Sucess:
* @returns {"token": "USERTOKEN", "user_settings": {"locale": "en", "theme": "dark"}}
-
+
*/
diff --git a/src/routes/users/@me/disable.ts b/src/routes/users/@me/disable.ts
index b16ef783..0e5b734e 100644
--- a/src/routes/users/@me/disable.ts
+++ b/src/routes/users/@me/disable.ts
@@ -1,10 +1,20 @@
+import { UserModel } from "@fosscord/server-util";
import { Router, Response, Request } from "express";
+import bcrypt from "bcrypt";
const router = Router();
-router.post("/", (req: Request, res: Response) => {
- // TODO:
- res.sendStatus(204);
+router.post("/", async (req: Request, res: Response) => {
+ const user = await UserModel.findOne({ id: req.user_id }).exec(); //User object
+
+ let correctpass = await bcrypt.compare(req.body.password, user!.user_data.hash); //Not sure if user typed right password :/
+ if (correctpass) {
+ await UserModel.updateOne({ id: req.user_id }, { disabled: true }).exec();
+
+ res.sendStatus(204);
+ } else {
+ res.status(400).json({ message: "Password does not match", code: 50018 });
+ }
});
export default router;
|