Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email auth updated translations. #137

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ auth/email-link:
jwtSecret: bogus
confirmationCode:
maxWrongAttemptsCount: 3
petName: Tenanter
appName: Tenant
teamName: Tenant
users: &users
kyc:
kyc-step1-reset-url: https://localhost:443/v1w/face-auth/
Expand Down
3 changes: 3 additions & 0 deletions auth/email_link/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ type (
config struct {
FromEmailName string `yaml:"fromEmailName"`
FromEmailAddress string `yaml:"fromEmailAddress"`
PetName string `yaml:"petName"`
AppName string `yaml:"appName"`
TeamName string `yaml:"teamName"`
LoginSession struct {
JwtSecret string `yaml:"jwtSecret"`
} `yaml:"loginSession"`
Expand Down
18 changes: 15 additions & 3 deletions auth/email_link/email_modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,38 @@ func (*client) resetFirebaseEmailModification(ctx context.Context, md *users.JSO
return nil
}

//nolint:funlen // .
func (c *client) sendNotifyEmailChanged(ctx context.Context, notifyEmail, newEmail, link, language string) error {
var tmpl *emailTemplate
tmpl, ok := allEmailLinkTemplates[notifyEmailChangedType][language]
if !ok {
tmpl = allEmailLinkTemplates[notifyEmailChangedType][defaultLanguage]
}
data := struct {
dataBody := struct {
NewEmail string
Link string
PetName string
AppName string
TeamName string
}{
NewEmail: newEmail,
Link: link,
PetName: c.cfg.PetName,
AppName: c.cfg.AppName,
TeamName: c.cfg.TeamName,
}
dataSubject := struct {
AppName string
}{
AppName: c.cfg.AppName,
}

return errors.Wrapf(c.emailClient.Send(ctx, &email.Parcel{
Body: &email.Body{
Type: email.TextHTML,
Data: tmpl.getBody(data),
Data: tmpl.getBody(dataBody),
},
Subject: tmpl.getSubject(nil),
Subject: tmpl.getSubject(dataSubject),
From: email.Participant{
Name: c.cfg.FromEmailName,
Email: c.cfg.FromEmailAddress,
Expand Down
9 changes: 9 additions & 0 deletions auth/email_link/emaillink.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ func (cfg *config) validate() {
if cfg.ConfirmationCode.MaxWrongAttemptsCount == 0 {
log.Panic("no max wrong attempts count provided for confirmation code")
}
if cfg.PetName == "" {
log.Panic("no pet name specified")
}
if cfg.AppName == "" {
log.Panic("no app name specified")
}
if cfg.TeamName == "" {
log.Panic("no team name specified")
}
}

func (t *emailTemplate) getSubject(data any) string {
Expand Down
18 changes: 15 additions & 3 deletions auth/email_link/link_start_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,38 @@ func (c *client) sendConfirmationCode(ctx context.Context, id *loginID, oldEmail
return errors.Wrapf(c.sendEmailWithType(ctx, emailType, id.Email, language, confirmationCode), "failed to send validation email for id:%#v", id)
}

//nolint:funlen // .
func (c *client) sendEmailWithType(ctx context.Context, emailType, toEmail, language, confirmationCode string) error {
var tmpl *emailTemplate
tmpl, ok := allEmailLinkTemplates[emailType][language]
if !ok {
tmpl = allEmailLinkTemplates[emailType][defaultLanguage]
}
data := struct {
dataBody := struct {
Email string
ConfirmationCode string
PetName string
AppName string
TeamName string
}{
Email: toEmail,
ConfirmationCode: confirmationCode,
PetName: c.cfg.PetName,
AppName: c.cfg.AppName,
TeamName: c.cfg.TeamName,
}
dataSubject := struct {
AppName string
}{
AppName: c.cfg.AppName,
}

return errors.Wrapf(c.emailClient.Send(ctx, &email.Parcel{
Body: &email.Body{
Type: email.TextHTML,
Data: tmpl.getBody(data),
Data: tmpl.getBody(dataBody),
},
Subject: tmpl.getSubject(nil),
Subject: tmpl.getSubject(dataSubject),
From: email.Participant{
Name: c.cfg.FromEmailName,
Email: c.cfg.FromEmailAddress,
Expand Down
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/af.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hallo {{.PetName}},</p>
<p>Ons het 'n versoek ontvang om by {{.AppName}} aan te meld met hierdie e-posadres. As jy met jou {{.Email}} rekening wil aanmeld, gebruik hierdie bevestigingskode:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>As jy nie hierdie kode aangevra het nie, kan jy hierdie e-pos veilig ignoreer.</p>
<p>Dankie,</p>
<p>{{.TeamName}}-span</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/af.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Teken in op {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/am.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>ሰላም {{.PetName}},</p>
<p>እነዚህን የኢሜል አድራሻ በመጠቀም ለ {{.AppName}} መግባት ጥያቄ ተቀብለናል። በ {{.Email}} አካውንት መግባት ከፈለጉ ይህን የማረጋገጫ ኮድ ተጠቀሙ:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>ይህን ኮድ ካልጠየቁ፣ ይህን ኢሜል ማለፍ ይችላሉ።</p>
<p>አመሰግናለሁ,</p>
<p>{{.TeamName}} ቡድን</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/am.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "ወደ {{.AppName}} ይግቡ"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/ar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>مرحبًا {{.PetName}}،</p>
<p>لقد تلقينا طلبًا لتسجيل الدخول إلى {{.AppName}} باستخدام عنوان البريد الإلكتروني هذا. إذا كنت ترغب في تسجيل الدخول باستخدام حساب {{.Email}} الخاص بك، فاستخدم رمز التأكيد هذا:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>إذا لم تطلب هذا الرمز، يمكنك تجاهل هذا البريد الإلكتروني بأمان.</p>
<p>شكرًا،</p>
<p>فريق {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/ar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "تسجيل الدخول إلى {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/az.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Salam {{.PetName}},</p>
<p>Bu e-poçt ünvanından istifadə edərək {{.AppName}}-ə daxil olmaq üçün sorğu aldıq. {{.Email}} hesabınızla daxil olmaq istəyirsinizsə, bu təsdiq kodundan istifadə edin:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Bu kodu tələb etməmisinizsə, bu e-poçtu etibarlı şəkildə yaddan çıxara bilərsiniz.</p>
<p>Təşəkkürlər,</p>
<p>{{.TeamName}} komandası</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/az.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "{{.AppName}}-a daxil olun"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/bg.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Здравейте {{.PetName}},</p>
<p>Получихме заявка за влизане в {{.AppName}}, използвайки този имейл адрес. Ако искате да влезете с акаунта си {{.Email}}, използвайте този код за потвърждение:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Ако не сте заявявали този код, можете спокойно да игнорирате този имейл.</p>
<p>Благодарим ви,</p>
<p>Екипът на {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/bg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Влезте в {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/bn.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>হাই {{.PetName}},</p>
<p>আমরা এই ইমেল ঠিকানা ব্যবহার করে {{.AppName}} এ সাইন ইন করার জন্য একটি অনুরোধ পেয়েছি। আপনি যদি আপনার {{.Email}} অ্যাকাউন্ট দিয়ে সাইন ইন করতে চান, তাহলে এই নিশ্চিতকরণ কোডটি ব্যবহার করুন:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>যদি আপনি এই কোডটির অনুরোধ না করে থাকেন, তাহলে আপনি নিরাপদে এই ইমেলটি উপেক্ষা করতে পারেন।</p>
<p>ধন্যবাদ,</p>
<p>{{.TeamName}} টিম</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/bn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "{{.AppName}} এ সাইন ইন করুন"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/cs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Ahoj {{.PetName}},</p>
<p>Obdrželi jsme žádost o přihlášení k {{.AppName}} pomocí této e-mailové adresy. Pokud se chcete přihlásit pomocí účtu {{.Email}}, použijte tento potvrzovací kód:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Pokud jste tento kód nepožadovali, můžete tento e-mail bezpečně ignorovat.</p>
<p>Děkujeme,</p>
<p>Tým {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/cs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Přihlaste se do {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/de.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hallo {{.PetName}},</p>
<p>Wir haben eine Anfrage zum Anmelden bei {{.AppName}} mit dieser E-Mail-Adresse erhalten. Wenn Sie sich mit Ihrem {{.Email}} Konto anmelden möchten, verwenden Sie diesen Bestätigungscode:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Wenn Sie diesen Code nicht angefordert haben, können Sie diese E-Mail sicher ignorieren.</p>
<p>Danke,</p>
<p>Das {{.TeamName}}-Team</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/de.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Melden Sie sich bei {{.AppName}} an"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/el.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Γεια σας {{.PetName}},</p>
<p>Λάβαμε ένα αίτημα για σύνδεση στο {{.AppName}} χρησιμοποιώντας αυτή τη διεύθυνση email. Αν θέλετε να συνδεθείτε με τον λογαριασμό σας {{.Email}}, χρησιμοποιήστε αυτόν τον κωδικό επιβεβαίωσης:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Αν δεν ζητήσατε αυτόν τον κωδικό, μπορείτε να αγνοήσετε με ασφάλεια αυτό το email.</p>
<p>Ευχαριστούμε,</p>
<p>Η ομάδα {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/el.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Συνδεθείτε στο {{.AppName}}"
}
10 changes: 5 additions & 5 deletions auth/email_link/translations/email/modify_email/en.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
SPDX-License-Identifier: ice License 1.0
-->

<p>Hi Snowman,</p>
<p>Your confirmation code:</p>
<p>{{.ConfirmationCode}}</p>
<p>If you did not ask to verify this, you can ignore this message.</p>
<p>Hi {{.PetName}},</p>
<p>We received a request to sign in to {{.AppName}} using this email address. If you want to sign in with your {{.Email}} account, use this confirmation code:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>If you did not request this code, you can safely ignore this email.</p>
<p>Thanks,</p>
<p>ice Team</p>
<p>{{.TeamName}} Team</p>
2 changes: 1 addition & 1 deletion auth/email_link/translations/email/modify_email/en.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"subject": "Verify your email for ice"
"subject": "Sign in to {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/es.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hola {{.PetName}},</p>
<p>Hemos recibido una solicitud para iniciar sesión en {{.AppName}} usando esta dirección de correo electrónico. Si deseas iniciar sesión con tu cuenta {{.Email}}, utiliza este código de confirmación:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Si no solicitaste este código, puedes ignorar este correo electrónico de manera segura.</p>
<p>Gracias,</p>
<p>Equipo de {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/es.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Inicia sesión en {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/fa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>سلام {{.PetName}}،</p>
<p>ما درخواستی برای ورود به {{.AppName}} با استفاده از این آدرس ایمیل دریافت کردیم. اگر می‌خواهید با حساب {{.Email}} خود وارد شوید، از این کد تأیید استفاده کنید:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>اگر این کد را درخواست نکرده‌اید، می‌توانید به راحتی این ایمیل را نادیده بگیرید.</p>
<p>با تشکر،</p>
<p>تیم {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/fa.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "ورود به {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/fr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Bonjour {{.PetName}},</p>
<p>Nous avons reçu une demande de connexion à {{.AppName}} utilisant cette adresse e-mail. Si vous souhaitez vous connecter avec votre compte {{.Email}}, utilisez ce code de confirmation :</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>Si vous n'avez pas demandé ce code, vous pouvez ignorer cet e-mail en toute sécurité.</p>
<p>Merci,</p>
<p>L'équipe {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/fr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "Connectez-vous à {{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/gu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>હાય {{.PetName}},</p>
<p>અમને આ ઇમેઇલ સરનામું વાપરીને {{.AppName}} માં સાઇન ઇન કરવાની વિનંતી મળી છે. જો તમે તમારા {{.Email}} ખાતા સાથે સાઇન ઇન કરવા માંગતા હો, તો આ પુષ્ટિકરણ કોડનો ઉપયોગ કરો:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>જો તમે આ કોડની વિનંતી ન કરી હોય, તો તમે આ ઇમેઇલને સુરક્ષિત રીતે અવગણો છો.</p>
<p>આભાર,</p>
<p>{{.TeamName}} ટીમ</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/gu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "{{.AppName}} માં સાઇન ઇન કરો"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/he.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>שלום {{.PetName}},</p>
<p>קיבלנו בקשה להתחבר ל-{{.AppName}} באמצעות כתובת דוא"ל זו. אם ברצונך להתחבר עם חשבון {{.Email}} שלך, השתמש בקוד האישור הזה:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>אם לא ביקשת קוד זה, תוכל להתעלם מדוא"ל זה בבטחה.</p>
<p>תודה,</p>
<p>צוות {{.TeamName}}</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/he.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "היכנס ל-{{.AppName}}"
}
10 changes: 10 additions & 0 deletions auth/email_link/translations/email/modify_email/hi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>नमस्ते {{.PetName}},</p>
<p>हमें इस ईमेल पते का उपयोग करके {{.AppName}} में साइन इन करने का अनुरोध प्राप्त हुआ है। यदि आप अपने {{.Email}} खाते के साथ साइन इन करना चाहते हैं, तो इस पुष्टि कोड का उपयोग करें:</p>
<p style="font-size:22px"><b>{{.ConfirmationCode}}</b></p>
<p>यदि आपने इस कोड का अनुरोध नहीं किया है, तो आप इस ईमेल को सुरक्षित रूप से अनदेखा कर सकते हैं।</p>
<p>धन्यवाद,</p>
<p>{{.TeamName}} टीम</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/hi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "{{.AppName}} में साइन इन करें"
}
Loading
Loading