A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(email): show IP and location in password reset emails
Hampusacf6d0ab88cb
diff --git a/fluxer_api/pkgs/email/scripts/RenderEmailPreviews.ts b/fluxer_api/pkgs/email/scripts/RenderEmailPreviews.tsindex 87894834c..45b081cf7 100644--- a/fluxer_api/pkgs/email/scripts/RenderEmailPreviews.ts+++ b/fluxer_api/pkgs/email/scripts/RenderEmailPreviews.ts@@ -144,7 +144,13 @@ const previews: Record<string, Preview> = {},locale,),- password_reset: (locale) => service.send('password_reset', USER, {resetToken: token}, locale),+ password_reset: (locale) =>+ service.send(+ 'password_reset',+ USER,+ {resetToken: token, ipAddress: '203.0.113.42', location: 'Stockholm, Sweden'},+ locale,+ ),email_verification: (locale) => service.send('email_verification', USER, {verificationToken: token}, locale),ip_authorization: (locale) =>service.send(diff --git a/fluxer_api/pkgs/email/src/EmailService.ts b/fluxer_api/pkgs/email/src/EmailService.tsindex c1ddd2356..0d76c07df 100644--- a/fluxer_api/pkgs/email/src/EmailService.ts+++ b/fluxer_api/pkgs/email/src/EmailService.ts@@ -334,9 +334,20 @@ export class EmailService implements IEmailService {email_change_new: async (email, {code}, locale) => {return this.sendCode(email, 'email_change_new', locale, code, {minutes: CODE_MINUTES});},- password_reset: async (email, {resetToken}, locale) => {+ password_reset: async (email, {resetToken, ipAddress, location}, locale) => {const resetUrl = `${this.config.appBaseUrl}/reset#token=${resetToken}`;- return this.sendTemplatedEmail(email, 'password_reset', locale, {}, {slots: () => ({cta_url: resetUrl})});+ return this.sendTemplatedEmail(+ email,+ 'password_reset',+ locale,+ {},+ {+ slots: (template) => ({+ cta_url: resetUrl,+ ...facts([template.ip_label, ipAddress], [template.location_label, location]),+ }),+ },+ );},email_verification: async (email, {verificationToken}, locale) => {const verifyUrl = `${this.config.appBaseUrl}/verify#token=${verificationToken}`;diff --git a/fluxer_api/pkgs/email/src/IEmailService.ts b/fluxer_api/pkgs/email/src/IEmailService.tsindex cee4758fd..0bf4d9b27 100644--- a/fluxer_api/pkgs/email/src/IEmailService.ts+++ b/fluxer_api/pkgs/email/src/IEmailService.ts@@ -153,7 +153,7 @@ export interface EmailSendParams {reauth_code: {code: string; expiresAt: Date};email_change_original: {code: string};email_change_new: {code: string};- password_reset: {resetToken: string};+ password_reset: {resetToken: string; ipAddress?: string; location?: string};email_verification: {verificationToken: string};ip_authorization: {authorizationToken: string; ipAddress: string; location: string};email_change_revert: {newEmail: string; token: string};diff --git a/fluxer_api/pkgs/email/src/TestEmailService.ts b/fluxer_api/pkgs/email/src/TestEmailService.tsindex 5ee847c06..4da7957d9 100644--- a/fluxer_api/pkgs/email/src/TestEmailService.ts+++ b/fluxer_api/pkgs/email/src/TestEmailService.ts@@ -72,8 +72,12 @@ export class TestEmailService implements IEmailService {email_change_new: async (email, {code}) => {return this.record(email, 'email_change_new', {code});},- password_reset: async (email, {resetToken}) => {- return this.record(email, 'password_reset', {token: resetToken});+ password_reset: async (email, {resetToken, ipAddress, location}) => {+ return this.record(email, 'password_reset', {+ token: resetToken,+ ...(ipAddress ? {ip: ipAddress} : {}),+ ...(location ? {location} : {}),+ });},email_verification: async (email, {verificationToken}) => {return this.record(email, 'email_verification', {token: verificationToken});diff --git a/fluxer_api/pkgs/email/src/email_i18n/EmailI18nMessages.ts b/fluxer_api/pkgs/email/src/email_i18n/EmailI18nMessages.tsindex 6a77f666c..1dc80a579 100644--- a/fluxer_api/pkgs/email/src/email_i18n/EmailI18nMessages.ts+++ b/fluxer_api/pkgs/email/src/email_i18n/EmailI18nMessages.ts@@ -415,6 +415,8 @@ export const EMAIL_I18N_MESSAGES = {password_reset: {subject: 'Reset your {product_name} password',intro: 'You asked to reset your {product_name} password.',+ ip_label: 'IP address',+ location_label: 'Location',cta: 'Set a new password',expiry: 'This link expires in 1 hour.',note: "If you didn't ask for this, you can ignore this email.",diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ar.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ar.jsonindex 572efc995..50f596535 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ar.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ar.json@@ -363,6 +363,8 @@"expiry": "تنتهي صلاحية هذا الرابط بعد ساعة واحدة.","footer_reason": "لقد تلقيت هذا البريد الإلكتروني لأنه تم طلب إعادة تعيين كلمة المرور لحسابك في {product_name}.","intro": "طلبت إعادة تعيين كلمة المرور في {product_name}.",+ "ip_label": "عنوان IP",+ "location_label": "الموقع","note": "إذا لم تطلب ذلك، يمكنك تجاهل هذا البريد الإلكتروني.","signoff": "فريق {product_name}","subject": "إعادة تعيين كلمة المرور في {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/bg.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/bg.jsonindex 848474819..eebb4054b 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/bg.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/bg.json@@ -363,6 +363,8 @@"expiry": "Този линк изтича след 1 час.","footer_reason": "Получи този имейл, защото е поискано нулиране на паролата за твоя акаунт във {product_name}.","intro": "Поиска да нулираш паролата си във {product_name}.",+ "ip_label": "IP адрес",+ "location_label": "Местоположение","note": "Ако не си поискал това, можеш да игнорираш този имейл.","signoff": "Екипът на {product_name}","subject": "Нулирай паролата си във {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/cs.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/cs.jsonindex ee1afdc0d..f024a3270 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/cs.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/cs.json@@ -363,6 +363,8 @@"expiry": "Tento odkaz vyprší za 1 hodinu.","footer_reason": "Tento e-mail jste obdrželi, protože bylo požádáno o obnovení hesla pro váš účet {product_name}.","intro": "Požádali jste o obnovení hesla k účtu {product_name}.",+ "ip_label": "IP adresa",+ "location_label": "Poloha","note": "Pokud jste o to nežádali, můžete tento e-mail ignorovat.","signoff": "Tým {product_name}","subject": "Obnovte své heslo k účtu {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/da.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/da.jsonindex c15e1ae09..548be83d4 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/da.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/da.json@@ -363,6 +363,8 @@"expiry": "Dette link udløber om 1 time.","footer_reason": "Du har modtaget denne e-mail, fordi der blev anmodet om nulstilling af adgangskode til din {product_name}-konto.","intro": "Du har bedt om at nulstille din {product_name}-adgangskode.",+ "ip_label": "IP-adresse",+ "location_label": "Sted","note": "Hvis du ikke har bedt om dette, kan du ignorere denne e-mail.","signoff": "Teamet bag {product_name}","subject": "Nulstil din {product_name}-adgangskode"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/de.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/de.jsonindex c2331675a..d3275bbea 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/de.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/de.json@@ -363,6 +363,8 @@"expiry": "Dieser Link läuft in 1 Stunde ab.","footer_reason": "Du hast diese E-Mail erhalten, weil für deinen {product_name}-Account das Zurücksetzen des Passworts angefordert wurde.","intro": "Du möchtest dein {product_name}-Passwort zurücksetzen.",+ "ip_label": "IP-Adresse",+ "location_label": "Standort","note": "Wenn du das nicht angefordert hast, kannst du diese E-Mail ignorieren.","signoff": "Das {product_name}-Team","subject": "Setze dein {product_name}-Passwort zurück"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/el.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/el.jsonindex cd9f7549a..16e8a3c6b 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/el.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/el.json@@ -363,6 +363,8 @@"expiry": "Αυτός ο σύνδεσμος λήγει σε 1 ώρα.","footer_reason": "Έλαβες αυτό το email επειδή ζητήθηκε επαναφορά κωδικού πρόσβασης για τον λογαριασμό σου στο {product_name}.","intro": "Ζήτησες επαναφορά του κωδικού πρόσβασής σου στο {product_name}.",+ "ip_label": "Διεύθυνση IP",+ "location_label": "Τοποθεσία","note": "Αν δεν το ζήτησες, μπορείς να αγνοήσεις αυτό το email.","signoff": "Η ομάδα του {product_name}","subject": "Επανάφερε τον κωδικό πρόσβασής σου στο {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/en-GB.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/en-GB.jsonindex 27ab31ac0..0e6188409 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/en-GB.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/en-GB.json@@ -363,6 +363,8 @@"expiry": "This link expires in 1 hour.","footer_reason": "You received this email because a password reset was requested for your {product_name} account.","intro": "You asked to reset your {product_name} password.",+ "ip_label": "IP address",+ "location_label": "Location","note": "If you didn't ask for this, you can ignore this email.","signoff": "The {product_name} team","subject": "Reset your {product_name} password"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-419.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-419.jsonindex b5b17627e..c90dda002 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-419.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-419.json@@ -363,6 +363,8 @@"expiry": "Este enlace vence en 1 hora.","footer_reason": "Recibiste este correo electrónico porque se solicitó un restablecimiento de contraseña para tu cuenta de {product_name}.","intro": "Pediste restablecer tu contraseña de {product_name}.",+ "ip_label": "Dirección IP",+ "location_label": "Ubicación","note": "Si no lo pediste tú, puedes ignorar este correo.","signoff": "El equipo de {product_name}","subject": "Restablece tu contraseña de {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-ES.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-ES.jsonindex 19ee42c30..c824c2953 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-ES.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/es-ES.json@@ -363,6 +363,8 @@"expiry": "Este enlace caduca en 1 hora.","footer_reason": "Has recibido este correo electrónico porque se ha solicitado un restablecimiento de contraseña para tu cuenta de {product_name}.","intro": "Has pedido restablecer tu contraseña de {product_name}.",+ "ip_label": "Dirección IP",+ "location_label": "Ubicación","note": "Si no lo has pedido tú, puedes ignorar este correo.","signoff": "El equipo de {product_name}","subject": "Restablece tu contraseña en {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fi.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fi.jsonindex 675f317c0..6373b31ac 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fi.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fi.json@@ -363,6 +363,8 @@"expiry": "Tämä linkki vanhenee tunnin kuluttua.","footer_reason": "Sait tämän sähköpostin, koska {product_name}-tilisi salasanan nollausta pyydettiin.","intro": "Pyysit {product_name}-salasanasi nollaamista.",+ "ip_label": "IP-osoite",+ "location_label": "Sijainti","note": "Jos et pyytänyt tätä, voit jättää tämän sähköpostin huomiotta.","signoff": "{product_name}-tiimi","subject": "Nollaa {product_name}-salasanasi"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fr.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fr.jsonindex cc4bd659e..da8764b6f 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fr.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/fr.json@@ -363,6 +363,8 @@"expiry": "Ce lien expire dans 1 heure.","footer_reason": "Vous avez reçu cet e-mail car une réinitialisation de mot de passe a été demandée pour votre compte {product_name}.","intro": "Vous avez demandé à réinitialiser votre mot de passe {product_name}.",+ "ip_label": "Adresse IP",+ "location_label": "Localisation","note": "Si vous n’avez rien demandé, vous pouvez ignorer cet e-mail.","signoff": "L’équipe {product_name}","subject": "Réinitialiser votre mot de passe {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/he.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/he.jsonindex c5400bbdb..04b757d63 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/he.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/he.json@@ -363,6 +363,8 @@"expiry": "הקישור הזה יפוג בעוד שעה.","footer_reason": "קיבלתם את האימייל הזה כי איפוס סיסמה התבקש עבור חשבון ה־{product_name} שלכם.","intro": "ביקשתם לאפס את הסיסמה שלכם ב-{product_name}.",+ "ip_label": "כתובת IP",+ "location_label": "מיקום","note": "אם לא ביקשתם את זה, אפשר להתעלם מהאימייל הזה.","signoff": "צוות {product_name}","subject": "איפוס הסיסמה שלכם ב-{product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hi.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hi.jsonindex f3c5aa023..d06839e36 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hi.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hi.json@@ -363,6 +363,8 @@"expiry": "यह लिंक 1 घंटे में एक्सपायर हो जाएगा।","footer_reason": "आपको यह ईमेल इसलिए मिला है क्योंकि आपके {product_name} अकाउंट के लिए पासवर्ड रीसेट का अनुरोध किया गया था।","intro": "आपने अपना {product_name} पासवर्ड रीसेट करने के लिए कहा था।",+ "ip_label": "IP एड्रेस",+ "location_label": "लोकेशन","note": "अगर आपने यह नहीं माँगा था, तो आप इस ईमेल को अनदेखा कर सकते हैं।","signoff": "{product_name} टीम","subject": "अपना {product_name} पासवर्ड रीसेट करें"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hr.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hr.jsonindex 6c711fa88..f2a5a1a42 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hr.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hr.json@@ -363,6 +363,8 @@"expiry": "Ova poveznica istječe za 1 sat.","footer_reason": "Ovu si e-poruku primio jer je zatraženo poništavanje lozinke za tvoj {product_name} račun.","intro": "Zatražio si poništavanje lozinke za {product_name}.",+ "ip_label": "IP adresa",+ "location_label": "Lokacija","note": "Ako to nisi zatražio, možeš zanemariti ovu e-poruku.","signoff": "Tim {product_name}a","subject": "Poništi svoju lozinku za {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hu.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hu.jsonindex 07931ca52..11a1c88b7 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hu.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/hu.json@@ -363,6 +363,8 @@"expiry": "Ez a link 1 óra múlva lejár.","footer_reason": "Ezt az e-mailt azért kaptad, mert jelszó-visszaállítást kértek a {product_name}-fiókodhoz.","intro": "Kérted {product_name}-jelszavad visszaállítását.",+ "ip_label": "IP-cím",+ "location_label": "Helyszín","note": "Ha nem te kérted, figyelmen kívül hagyhatod ezt az e-mailt.","signoff": "{product_name} csapata","subject": "Állítsd vissza {product_name}-fiókod jelszavát"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/id.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/id.jsonindex a80ef4d05..be358e944 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/id.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/id.json@@ -363,6 +363,8 @@"expiry": "Tautan ini kedaluwarsa dalam 1 jam.","footer_reason": "Kamu menerima email ini karena ada permintaan pengaturan ulang kata sandi untuk akun {product_name} kamu.","intro": "Kamu meminta untuk mengatur ulang kata sandi {product_name} kamu.",+ "ip_label": "Alamat IP",+ "location_label": "Lokasi","note": "Jika kamu tidak memintanya, kamu bisa mengabaikan email ini.","signoff": "Tim {product_name}","subject": "Atur ulang kata sandi {product_name} kamu"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/it.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/it.jsonindex 466fc8703..35c4b4638 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/it.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/it.json@@ -363,6 +363,8 @@"expiry": "Questo link scade tra 1 ora.","footer_reason": "Hai ricevuto questa email perché è stata richiesta la reimpostazione della password per il tuo account {product_name}.","intro": "Hai chiesto di reimpostare la password di {product_name}.",+ "ip_label": "Indirizzo IP",+ "location_label": "Posizione","note": "Se non l'hai chiesto tu, puoi ignorare questa email.","signoff": "Il team di {product_name}","subject": "Reimposta la password di {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ja.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ja.jsonindex d1f3cf4d6..c23541d09 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ja.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ja.json@@ -363,6 +363,8 @@"expiry": "このリンクは1時間後に期限切れになります。","footer_reason": "このメールは、お使いの{product_name}アカウントのパスワードリセットがリクエストされたため送信されました。","intro": "{product_name}のパスワードのリセットを受け付けました。",+ "ip_label": "IPアドレス",+ "location_label": "場所","note": "リクエストしていない場合は、このメールを無視してかまいません。","signoff": "{product_name}チーム","subject": "{product_name}のパスワードをリセット"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ko.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ko.jsonindex 9c0984fbe..c07a209b8 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ko.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ko.json@@ -363,6 +363,8 @@"expiry": "이 링크는 1시간 후에 만료돼요.","footer_reason": "회원님의 {product_name} 계정 비밀번호 재설정이 요청되어 이 이메일을 받으셨어요.","intro": "{product_name} 비밀번호 재설정을 요청하셨어요.",+ "ip_label": "IP 주소",+ "location_label": "위치","note": "요청하지 않으셨다면 이 이메일을 무시해도 돼요.","signoff": "{product_name} 팀 드림","subject": "{product_name} 비밀번호 재설정"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/lt.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/lt.jsonindex 0dcaeff0e..14b723674 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/lt.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/lt.json@@ -363,6 +363,8 @@"expiry": "Ši nuoroda galioja 1 valandą.","footer_reason": "Gavai šį el. laišką, nes buvo paprašyta iš naujo nustatyti tavo {product_name} paskyros slaptažodį.","intro": "Paprašei iš naujo nustatyti savo {product_name} slaptažodį.",+ "ip_label": "IP adresas",+ "location_label": "Vieta","note": "Jei to neprašei, gali ignoruoti šį el. laišką.","signoff": "{product_name} komanda","subject": "Iš naujo nustatyk savo {product_name} slaptažodį"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/nl.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/nl.jsonindex d5f37f5ca..904860c65 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/nl.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/nl.json@@ -363,6 +363,8 @@"expiry": "Deze link verloopt over 1 uur.","footer_reason": "Je hebt deze e-mail ontvangen omdat er een wachtwoordreset is aangevraagd voor je {product_name}-account.","intro": "Je hebt gevraagd om je {product_name}-wachtwoord opnieuw in te stellen.",+ "ip_label": "IP-adres",+ "location_label": "Locatie","note": "Als je hier niet om hebt gevraagd, kun je deze e-mail negeren.","signoff": "Het team van {product_name}","subject": "Stel je {product_name}-wachtwoord opnieuw in"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/no.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/no.jsonindex 119314304..c866bd634 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/no.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/no.json@@ -363,6 +363,8 @@"expiry": "Denne lenken utløper om 1 time.","footer_reason": "Du mottok denne e-posten fordi en tilbakestilling av passord ble forespurt for din {product_name}-konto.","intro": "Du ba om å tilbakestille {product_name}-passordet ditt.",+ "ip_label": "IP-adresse",+ "location_label": "Sted","note": "Hvis du ikke ba om dette, kan du ignorere denne e-posten.","signoff": "{product_name}-teamet","subject": "Tilbakestill {product_name}-passordet ditt"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pl.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pl.jsonindex 408c5fac7..2ecf26e5e 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pl.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pl.json@@ -363,6 +363,8 @@"expiry": "Ten link wygaśnie za 1 godzinę.","footer_reason": "Otrzymujesz tę wiadomość, ponieważ wpłynęła prośba o zresetowanie hasła do Twojego konta {product_name}.","intro": "Otrzymaliśmy prośbę o zresetowanie Twojego hasła do {product_name}.",+ "ip_label": "Adres IP",+ "location_label": "Lokalizacja","note": "Jeśli ta prośba nie pochodzi od Ciebie, możesz zignorować tę wiadomość.","signoff": "Zespół {product_name}","subject": "Zresetuj hasło w {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pt-BR.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pt-BR.jsonindex 398c48f0d..d183fff02 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pt-BR.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/pt-BR.json@@ -363,6 +363,8 @@"expiry": "Este link expira em 1 hora.","footer_reason": "Você recebeu este e-mail porque uma redefinição de senha foi solicitada para sua conta do {product_name}.","intro": "Você pediu para redefinir sua senha do {product_name}.",+ "ip_label": "Endereço IP",+ "location_label": "Localização","note": "Se você não pediu isso, pode ignorar este e-mail.","signoff": "Equipe do {product_name}","subject": "Redefina a senha da sua conta do {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ro.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ro.jsonindex 4ea2adde6..784ce0634 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ro.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ro.json@@ -363,6 +363,8 @@"expiry": "Acest link expiră într-o oră.","footer_reason": "Ai primit acest e-mail deoarece a fost solicitată o resetare a parolei pentru contul tău {product_name}.","intro": "Ai cerut resetarea parolei {product_name}.",+ "ip_label": "Adresă IP",+ "location_label": "Locație","note": "Dacă nu ai cerut asta, poți ignora acest e-mail.","signoff": "Echipa {product_name}","subject": "Resetează-ți parola pentru {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ru.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ru.jsonindex 910c9053e..65753263c 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ru.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/ru.json@@ -363,6 +363,8 @@"expiry": "Срок действия ссылки истекает через час.","footer_reason": "Вы получили это письмо, потому что был запрошен сброс пароля для вашего аккаунта {product_name}.","intro": "Вы запросили сброс пароля {product_name}.",+ "ip_label": "IP-адрес",+ "location_label": "Местоположение","note": "Если вы этого не запрашивали, можете проигнорировать это письмо.","signoff": "Команда {product_name}","subject": "Сбросьте пароль для {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/sv-SE.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/sv-SE.jsonindex c75b4a977..7b8e82986 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/sv-SE.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/sv-SE.json@@ -363,6 +363,8 @@"expiry": "Länken går ut om 1 timme.","footer_reason": "Du fick det här mejlet eftersom en begäran om återställning av lösenord gjordes för ditt {product_name}-konto.","intro": "Du har bett om att återställa ditt lösenord på {product_name}.",+ "ip_label": "IP-adress",+ "location_label": "Plats","note": "Om du inte bad om det här kan du ignorera det här mejlet.","signoff": "{product_name}-teamet","subject": "Återställ ditt lösenord på {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/th.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/th.jsonindex 6717abe5c..88faf01d2 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/th.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/th.json@@ -363,6 +363,8 @@"expiry": "ลิงก์นี้จะหมดอายุใน 1 ชั่วโมง","footer_reason": "คุณได้รับอีเมลนี้เนื่องจากมีการร้องขอรีเซ็ตรหัสผ่านสำหรับบัญชี {product_name} ของคุณ","intro": "คุณขอรีเซ็ตรหัสผ่าน {product_name} ของคุณ",+ "ip_label": "ที่อยู่ IP",+ "location_label": "ตำแหน่งที่ตั้ง","note": "หากคุณไม่ได้ขอเรื่องนี้ คุณเพิกเฉยต่ออีเมลนี้ได้","signoff": "ทีม {product_name}","subject": "รีเซ็ตรหัสผ่านสำหรับ {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/tr.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/tr.jsonindex 6844e411c..d8020b59a 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/tr.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/tr.json@@ -363,6 +363,8 @@"expiry": "Bu bağlantının süresi 1 saat içinde dolacak.","footer_reason": "Bu e-postayı, {product_name} hesabınız için şifre sıfırlama istendiği için aldınız.","intro": "{product_name} şifrenizi sıfırlamak istediniz.",+ "ip_label": "IP adresi",+ "location_label": "Konum","note": "Bunu siz istemediyseniz bu e-postayı yok sayabilirsiniz.","signoff": "{product_name} ekibi","subject": "{product_name} şifrenizi sıfırlayın"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/uk.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/uk.jsonindex 8c28336ef..c8f7dc986 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/uk.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/uk.json@@ -363,6 +363,8 @@"expiry": "Посилання діє 1 годину.","footer_reason": "Ти отримав цей лист, оскільки було надіслано запит на скидання пароля для твого акаунта {product_name}.","intro": "Ти запитав скидання пароля {product_name}.",+ "ip_label": "IP-адреса",+ "location_label": "Місцезнаходження","note": "Якщо ти цього не запитував, можеш проігнорувати цей лист.","signoff": "Команда {product_name}","subject": "Скинь свій пароль для {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/vi.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/vi.jsonindex 75b498158..1e52b4ead 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/vi.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/vi.json@@ -363,6 +363,8 @@"expiry": "Liên kết này sẽ hết hạn sau 1 giờ.","footer_reason": "Bạn nhận được email này vì đã có yêu cầu đặt lại mật khẩu cho tài khoản {product_name} của bạn.","intro": "Bạn đã yêu cầu đặt lại mật khẩu {product_name} của mình.",+ "ip_label": "Địa chỉ IP",+ "location_label": "Vị trí","note": "Nếu bạn không yêu cầu việc này, bạn có thể bỏ qua email này.","signoff": "Đội ngũ {product_name}","subject": "Đặt lại mật khẩu của bạn trên {product_name}"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-CN.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-CN.jsonindex db47814b3..f37e85f17 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-CN.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-CN.json@@ -363,6 +363,8 @@"expiry": "此链接将在 1 小时后过期。","footer_reason": "你收到此邮件是因为你的 {product_name} 账号请求了密码重置。","intro": "你申请了重置 {product_name} 密码。",+ "ip_label": "IP 地址",+ "location_label": "位置","note": "如果你没有提出此请求,可以忽略此邮件。","signoff": "{product_name} 团队","subject": "重置你的 {product_name} 账号密码"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-TW.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-TW.jsonindex f9c6a18d1..c553f28d7 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-TW.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/locales/zh-TW.json@@ -363,6 +363,8 @@"expiry": "此連結將在 1 小時後到期。","footer_reason": "您收到這封電子郵件,是因為您的 {product_name} 帳號要求重設密碼。","intro": "您要求重設 {product_name} 密碼。",+ "ip_label": "IP 位址",+ "location_label": "位置","note": "如果您沒有提出這項要求,可以忽略這封電子郵件。","signoff": "{product_name} 團隊","subject": "重設您的 {product_name} 密碼"diff --git a/fluxer_api/pkgs/email/src/email_i18n/weblate/messages.json b/fluxer_api/pkgs/email/src/email_i18n/weblate/messages.jsonindex 6a82f6673..8060bc8ab 100644--- a/fluxer_api/pkgs/email/src/email_i18n/weblate/messages.json+++ b/fluxer_api/pkgs/email/src/email_i18n/weblate/messages.json@@ -361,6 +361,8 @@"password_reset": {"subject": "Reset your {product_name} password","intro": "You asked to reset your {product_name} password.",+ "ip_label": "IP address",+ "location_label": "Location","cta": "Set a new password","expiry": "This link expires in 1 hour.","note": "If you didn't ask for this, you can ignore this email.",diff --git a/fluxer_api/src/api/auth/AuthPassword.ts b/fluxer_api/src/api/auth/AuthPassword.tsindex 79a1fab8d..2d4776c57 100644--- a/fluxer_api/src/api/auth/AuthPassword.ts+++ b/fluxer_api/src/api/auth/AuthPassword.ts@@ -10,6 +10,7 @@ import {RecoveryKitRepository} from '@app/api/auth/services/RecoveryKitRepositorimport {resolveWebAuthnSecondFactor} from '@app/api/auth/services/WebAuthnSecondFactor';import {createPasswordResetToken} from '@app/api/BrandedTypes';import {Config} from '@app/api/Config';+import {getContentMessage} from '@app/api/content_i18n/ContentI18n';import type {UserRow} from '@app/api/database/types/UserTypes';import {Logger} from '@app/api/Logger';import {getKVClient} from '@app/api/middleware/ServiceRegistry';@@ -17,6 +18,7 @@ import type {User} from '@app/api/models/User';import {PASSWORD_RESET_TOKEN_TTL_SECONDS} from '@app/api/user/repositories/auth/TokenRepository';import {EXTERNAL_RESPONSE_LIMITS} from '@app/api/utils/ExternalResponseLimits';import * as FetchUtils from '@app/api/utils/FetchUtils';+import {lookupGeoip} from '@app/api/utils/IpUtils';import {hashPassword} from '@app/api/utils/PasswordUtils';import * as RandomUtils from '@app/api/utils/RandomUtils';import {createRateLimitError} from '@app/api/utils/RateLimitUtils';@@ -27,6 +29,7 @@ import {ValidationErrorCodes} from '@fluxer/constants/src/ValidationErrorCodes';import {InputValidationError} from '@fluxer/errors/src/domains/core/InputValidationError';import {getSameIpDecisionKey} from '@fluxer/ip_utils/src/IpAddress';import type {ForgotPasswordRequest, ResetPasswordRequest} from '@fluxer/schema/src/domains/auth/AuthSchemas';+import {formatGeoipLocation} from '@pkgs/geoip/src/GeoipLookup';import {ms} from 'itty-time';const PWNED_PASSWORDS_TIMEOUT_MS = ms('5 seconds');@@ -218,7 +221,10 @@ export async function forgotPassword(ctx: ApiContext, {data, request}: ForgotPasuser_id: user.id,email: user.email!,});- await email.send('password_reset', user.email!, {resetToken: token}, user.locale);+ const location =+ formatGeoipLocation(await lookupGeoip(clientIp), user.locale) ??+ getContentMessage('auth.unknown_location', user.locale);+ await email.send('password_reset', user.email!, {resetToken: token, ipAddress: clientIp, location}, user.locale);}function resetTokenMatchesUser(user: User, tokenEmail: string | null): boolean {