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 2 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
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hallo {{.PetName}},</p>
<p>Jou aanmeld-e-pos vir {{.AppName}} is verander na <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>As jy nie gevra het om jou e-pos te verander nie, volg <a href="{{.Link}}" target="_blank">hierdie skakel</a> om jou aanmeld-e-pos terug te stel.</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": "Jou aanmeld-e-pos is verander vir {{.AppName}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>ሰላም {{.PetName}},</p>
<p>የሚከታተሉትን ኢሜል አድራሻ ለ {{.AppName}} ይለውጡ <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>ኢሜልዎን ለማስተካከል ካላሳለፉ፣ <a href="{{.Link}}" target="_blank">እነዚህን አገናኝ</a> ይከተሉ።</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}} ተቀይሯል"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>مرحبًا {{.PetName}}،</p>
<p>تم تغيير البريد الإلكتروني الخاص بك لتسجيل الدخول إلى {{.AppName}} إلى <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>إذا لم تطلب تغيير بريدك الإلكتروني، فاتبع <a href="{{.Link}}" target="_blank">هذا الرابط</a> لإعادة تعيين بريدك الإلكتروني لتسجيل الدخول.</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}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Salam {{.PetName}},</p>
<p>{{.AppName}}-a giriş üçün e-poçt ünvanınız <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> olaraq dəyişdirildi.</p>
<p>E-poçt ünvanınızı dəyişdirməyi istəmədiyiniz halda, <a href="{{.Link}}" target="_blank">bu linki</a> izləyərək giriş e-poçtunuzu sıfırlayın.</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}} üçün giriş e-poçtunuz dəyişdirildi"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Здравейте {{.PetName}},</p>
<p>Вашият имейл за вход в {{.AppName}} беше променен на <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Ако не сте поискали да промените имейла си, следвайте <a href="{{.Link}}" target="_blank">този линк</a>, за да нулирате имейла за вход.</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}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>হাই {{.PetName}},</p>
<p>আপনার {{.AppName}} সাইন-ইন ইমেল <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> এ পরিবর্তন করা হয়েছে।</p>
<p>যদি আপনি আপনার ইমেল পরিবর্তন করতে না চান, তাহলে <a href="{{.Link}}" target="_blank">এই লিঙ্কটি</a> অনুসরণ করে আপনার সাইন-ইন ইমেল রিসেট করুন।</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}} এর জন্য পরিবর্তিত হয়েছে"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Ahoj {{.PetName}},</p>
<p>Váš přihlašovací email pro {{.AppName}} byl změněn na <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Pokud jste nepožádali o změnu emailu, postupujte podle <a href="{{.Link}}" target="_blank">tohoto odkazu</a> pro resetování přihlašovacího emailu.</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": "Váš přihlašovací email byl změněn pro {{.AppName}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hallo {{.PetName}},</p>
<p>Ihre Anmelde-E-Mail für {{.AppName}} wurde in <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> geändert.</p>
<p>Wenn Sie nicht darum gebeten haben, Ihre E-Mail zu ändern, folgen Sie <a href="{{.Link}}" target="_blank">diesem Link</a>, um Ihre Anmelde-E-Mail zurückzusetzen.</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": "Ihre Anmelde-E-Mail wurde für {{.AppName}} geändert"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Γεια σας {{.PetName}},</p>
<p>Το email σύνδεσής σας για το {{.AppName}} άλλαξε σε <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Αν δεν ζητήσατε να αλλάξετε το email σας, ακολουθήστε <a href="{{.Link}}" target="_blank">αυτόν τον σύνδεσμο</a> για να επαναφέρετε το 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": "Το email σύνδεσής σας άλλαξε για το {{.AppName}}"
}
9 changes: 4 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,8 @@
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>Your sign-in email for {{.AppName}} was changed to <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>If you did not ask to change your email, follow <a href="{{.Link}}" target="_blank">this link</a> to reset your sign-in 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": "Your sign-in email was changed for {{.AppName}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Hola {{.PetName}},</p>
<p>Tu correo electrónico de inicio de sesión para {{.AppName}} se cambió a <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Si no solicitaste cambiar tu correo electrónico, sigue <a href="{{.Link}}" target="_blank">este enlace</a> para restablecer tu correo electrónico de inicio de sesión.</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": "Tu correo electrónico de inicio de sesión fue cambiado para {{.AppName}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>سلام {{.PetName}}،</p>
<p>ایمیل ورود شما برای {{.AppName}} به <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> تغییر کرد.</p>
<p>اگر شما درخواست تغییر ایمیل خود را نداده‌اید، از <a href="{{.Link}}" target="_blank">این لینک</a> برای بازنشانی ایمیل ورود خود استفاده کنید.</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}} تغییر یافت"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Bonjour {{.PetName}},</p>
<p>Votre email de connexion pour {{.AppName}} a été changé en <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Si vous n'avez pas demandé à changer votre email, suivez <a href="{{.Link}}" target="_blank">ce lien</a> pour réinitialiser votre email de connexion.</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": "Votre email de connexion a été changé pour {{.AppName}}"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>હાય {{.PetName}},</p>
<p>તમારો {{.AppName}} માટેનો સાઇન-ઇન ઇમેઇલ <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> પર બદલવામાં આવ્યો હતો.</p>
<p>જો તમે તમારો ઇમેઇલ બદલવા માટે નથી કહેલું, તો તમારો સાઇન-ઇન ઇમેઇલ ફરીથી સેટ કરવા માટે <a href="{{.Link}}" target="_blank">આ લિંક</a> નો ઉપયોગ કરો.</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}} માટે બદલવામાં આવ્યો હતો"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>שלום {{.PetName}},</p>
<p>כתובת הדוא"ל שלך לכניסה ל-{{.AppName}} שונתה ל-<a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>אם לא ביקשת לשנות את כתובת הדוא"ל שלך, לחץ <a href="{{.Link}}" target="_blank">על קישור זה</a> כדי לאפס את כתובת הדוא"ל שלך לכניסה.</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}} שונתה"
}
9 changes: 9 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,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>नमस्ते {{.PetName}},</p>
<p>आपके {{.AppName}} में साइन-इन ईमेल को <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a> में बदल दिया गया है।</p>
<p>यदि आपने अपना ईमेल बदलने के लिए नहीं कहा है, तो अपना साइन-इन ईमेल रीसेट करने के लिए <a href="{{.Link}}" target="_blank">इस लिंक</a> का पालन करें।</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}} के लिए आपका साइन-इन ईमेल बदल दिया गया है"
}
9 changes: 9 additions & 0 deletions auth/email_link/translations/email/modify_email/hu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--
SPDX-License-Identifier: ice License 1.0
-->

<p>Szia {{.PetName}},</p>
<p>A {{.AppName}} bejelentkezési e-mailed megváltozott erre: <a href="mailto:{{.NewEmail}}" target="_blank">{{.NewEmail}}</a>.</p>
<p>Ha nem kértél e-mail-cím változtatást, kövesd <a href="{{.Link}}" target="_blank">ezt a linket</a> a bejelentkezési e-mailed visszaállításához.</p>
<p>Köszönöm,</p>
<p>{{.TeamName}} csapat</p>
3 changes: 3 additions & 0 deletions auth/email_link/translations/email/modify_email/hu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subject": "A bejelentkezési e-mailed megváltozott a {{.AppName}}-hez"
}
Loading
Loading