diff --git a/auth/assets/templates/authorized-clients.html.tpl b/auth/assets/templates/authorized-clients.html.tpl index 6c538da95..873dfd7aa 100644 --- a/auth/assets/templates/authorized-clients.html.tpl +++ b/auth/assets/templates/authorized-clients.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" set . "activeNav" "clients" }}
-

Authorized clients

+

{{ tr "authorized-clients.template.title" }}

{{ .Name }}
- Authorized on + {{ tr "authorized-clients.template.authorized" }}
{{ else }}
- No authorized clients found + {{ tr "authorized-clients.template.no-auth-clients" }}
{{ end }}
diff --git a/auth/assets/templates/change-password.html.tpl b/auth/assets/templates/change-password.html.tpl index b918cc9e0..799fba50a 100644 --- a/auth/assets/templates/change-password.html.tpl +++ b/auth/assets/templates/change-password.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" set . "activeNav" "security" }}
-

Change your password

+

{{ tr "change-password.template.title" }}

+ aria-label="{{ tr "change-password.template.form.email.aria-label" }}">
+ placeholder="{{ tr "change-password.template.form.old-password.placeholder" }}" + aria-label="{{ tr "change-password.template.form.old-password.aria-label" }}">
+ placeholder="{{ tr "change-password.template.form.new-password.placeholder" }}" + aria-label="{{ tr "change-password.template.form.new-password.aria-label" }}">
- +
diff --git a/auth/assets/templates/error-internal.html.tpl b/auth/assets/templates/error-internal.html.tpl index 18c028897..78dac8c25 100644 --- a/auth/assets/templates/error-internal.html.tpl +++ b/auth/assets/templates/error-internal.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" . }}
-

Internal error

+

{{ tr "error-internal.template.title" }}

diff --git a/auth/assets/templates/inc_footer.html.tpl b/auth/assets/templates/inc_footer.html.tpl index 9302ee294..7e10bb401 100644 --- a/auth/assets/templates/inc_footer.html.tpl +++ b/auth/assets/templates/inc_footer.html.tpl @@ -1,19 +1,11 @@ {{ template "inc_toasts.html.tpl" .alerts }} - {{ if .user }} -
- You're logged-in as - {{ coalesce .user.Name .user.Handle .user.Email }} - | - Logout -
- {{ end }} - version {{ version }} + {{ tr "inc_footer.version" "version" version }} diff --git a/auth/assets/templates/inc_header.html.tpl b/auth/assets/templates/inc_header.html.tpl index 4e3d3367e..7f9f4320e 100644 --- a/auth/assets/templates/inc_header.html.tpl +++ b/auth/assets/templates/inc_header.html.tpl @@ -17,6 +17,14 @@ + {{ if .user }} + + {{ end }}
{{ template "inc_nav.html.tpl" . }} diff --git a/auth/assets/templates/inc_nav.html.tpl b/auth/assets/templates/inc_nav.html.tpl index 28c1d2053..ebbe3c8c9 100644 --- a/auth/assets/templates/inc_nav.html.tpl +++ b/auth/assets/templates/inc_nav.html.tpl @@ -11,23 +11,23 @@ {{ if and .user .client }} {{ else if .user }} {{ end }} diff --git a/auth/assets/templates/login.html.tpl b/auth/assets/templates/login.html.tpl index f8b7f5803..eeb314ec3 100644 --- a/auth/assets/templates/login.html.tpl +++ b/auth/assets/templates/login.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" . }}
-

Log in

+

{{ tr "login.template.title" }}

{{ if .settings.LocalEnabled }}
+ aria-label="{{ tr "login.template.form.email.label" }}">
{{ if not .form.splitCredentialsCheck }}
+ aria-label="{{ tr "login.template.form.password.labels" }}">
@@ -49,13 +49,13 @@ value="true" type="submit" > - Log in and remember me + {{ tr "login.template.form.button.login-and-remember" }}
@@ -68,7 +68,7 @@ value="true" type="submit" > - Continue + {{ tr "login.template.form.button.continue" }}
@@ -77,12 +77,12 @@
{{ if .settings.PasswordResetEnabled }} {{ end }} {{ if .settings.SignupEnabled }} {{ end }}
@@ -92,7 +92,7 @@ {{ range .providers }} - Login with {{ coalesce .Label .Handle }} + {{ tr "login.template.external.login-with" "idp" (coalesce .Label .Handle) }} {{ end }} diff --git a/auth/assets/templates/logout.html.tpl b/auth/assets/templates/logout.html.tpl index 6f2322dd8..adb6adc9f 100644 --- a/auth/assets/templates/logout.html.tpl +++ b/auth/assets/templates/logout.html.tpl @@ -7,7 +7,7 @@ {{ else }}
- Log out successful. + {{ tr "logout.log-out" }}
{{ end }} diff --git a/auth/assets/templates/mfa-totp-disable.html.tpl b/auth/assets/templates/mfa-totp-disable.html.tpl index 279570b47..2f82ab2a8 100644 --- a/auth/assets/templates/mfa-totp-disable.html.tpl +++ b/auth/assets/templates/mfa-totp-disable.html.tpl @@ -1,13 +1,13 @@ {{ template "inc_header.html.tpl" set . "hideNav" true }}
-

Disable two-factor authentication with TOTP

+

{{ tr "mfa_totp_disable.template.title" }}

- Disable by entering existing code. + {{ tr "mfa_totp_disable.template.form.title" }} {{ if .form.error }} diff --git a/auth/assets/templates/mfa-totp.html.tpl b/auth/assets/templates/mfa-totp.html.tpl index 687c9dd02..714d86fe0 100644 --- a/auth/assets/templates/mfa-totp.html.tpl +++ b/auth/assets/templates/mfa-totp.html.tpl @@ -4,8 +4,7 @@ {{ if .enforced }}

- TOTP multi factor authentication is enforced by Corteza administrator. - Please configure it right away. + {{ tr "mfa_totp.template.paragraph" }}

{{ end }} @@ -21,7 +20,7 @@ method="POST" action="{{ links.MfaTotpNewSecret }}" > - Complete the configuration by entering code from the authenticator application: + {{ tr "mfa_totp.template.form.title-2" }} {{ if .form.error }}

- Corteza uses time based one time passwords (TOTP) as one of the - underlying technologies for two-factor authentication. - Use one of the applications listed below and type in the secret or scan the QR code. + {{ tr "mfa_totp.template.form.paragraph-one" }}

- This will enable additional security for your account. + {{ tr "mfa_totp.template.form.paragraph-two" }}

- You can use one of the following applications: + {{ tr "mfa_totp.template.form.paragraph-three" }}

diff --git a/auth/assets/templates/mfa.html.tpl b/auth/assets/templates/mfa.html.tpl index 0d7afe7e1..94ef85f67 100644 --- a/auth/assets/templates/mfa.html.tpl +++ b/auth/assets/templates/mfa.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" set . "hideNav" true }}
-

Multi-factor authentication

+

{{ tr "mfa.template.title" }}

{{ if .emailOtpPending }}
-
Check your inbox and enter the received code
+
{{ tr "mfa.template.form-1.title" }}
{{ if .form.emailOtpError }} - Resend + {{ tr "mfa.buttons.resend" }}
{{ else if not .emailOtpDisabled }}

- Email OTP confirmed + {{ tr "mfa.paragraph-1" }}

{{ end }} @@ -63,7 +63,7 @@ method="POST" action="{{ links.Mfa }}" > -
Check your TOTP application and enter the code you received
+
{{ tr "mfa.template.form-2.title" }}
{{ if .form.totpError }} {{ else if not .totpDisabled }}

- TOTP confirmed + {{ tr "mfa.paragraph-2" }}

{{ end }}
diff --git a/auth/assets/templates/oauth2-authorize-client.html.tpl b/auth/assets/templates/oauth2-authorize-client.html.tpl index 39bffbe30..f7bdbdd15 100644 --- a/auth/assets/templates/oauth2-authorize-client.html.tpl +++ b/auth/assets/templates/oauth2-authorize-client.html.tpl @@ -7,7 +7,7 @@
{{ end }} -

Authorize "{{ coalesce .client.Name }}"

+

{{ tr "oauth2_authorize_client.template.title" }} "{{ coalesce .client.Name }}"

{{ .csrfField }}

- Hello {{ coalesce .user.Name .user.Handle .user.Email }}, + {{ tr "oauth2_authorize_client.template.form.greeting-paragraph" }} {{ coalesce .user.Name .user.Handle .user.Email }},

- {{ .client.Name }} would like to perform actions on this Corteza server on your behalf. + {{ .client.Name }} {{ tr "oauth2_authorize_client.template.form.question-for-client" }}

@@ -30,7 +30,7 @@ class="btn btn-{{ if .disabled }}secondary{{ else }}primary{{ end }} btn-lg m-2" style="width:250px;" > - Allow + {{ tr "oauth2_authorize_client.template.form.button-allow" }}

- If this is a mistake, please log out. + {{ tr "oauth2_authorize_client.template.form.mistake" }} {{ tr "oauth2_authorize_client.template.form.log-out-link" }}.
diff --git a/auth/assets/templates/password-reset-requested.html.tpl b/auth/assets/templates/password-reset-requested.html.tpl index e84ef42b0..dcd2d9bfc 100644 --- a/auth/assets/templates/password-reset-requested.html.tpl +++ b/auth/assets/templates/password-reset-requested.html.tpl @@ -1,13 +1,13 @@ {{ template "inc_header.html.tpl" . }}
-

Password reset requested

+

{{ tr "password_reset_requested.template.title" }}

{{ template "inc_footer.html.tpl" . }} diff --git a/auth/assets/templates/pending-email-confirmation.html.tpl b/auth/assets/templates/pending-email-confirmation.html.tpl index 4ee2853f1..f6e76cdd5 100644 --- a/auth/assets/templates/pending-email-confirmation.html.tpl +++ b/auth/assets/templates/pending-email-confirmation.html.tpl @@ -1,13 +1,13 @@ {{ template "inc_header.html.tpl" . }}
-

Confirm your email

+

{{ tr "pending_email_confirmation.template.title" }}

{{ template "inc_footer.html.tpl" . }} diff --git a/auth/assets/templates/profile.html.tpl b/auth/assets/templates/profile.html.tpl index 74116426d..e4f31faad 100644 --- a/auth/assets/templates/profile.html.tpl +++ b/auth/assets/templates/profile.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" set . "activeNav" "profile" }}
-

Your profile

+

{{ tr "profile.template.title" }}

- + + aria-label="{{ tr "profile.template.form.email.aria-label" }}">
{{ if .emailConfirmationRequired }}
- Email is not verified, resend confirmation link. + {{ tr "profile.template.form.text-danger-1" }} {{ tr "profile.template.form.text-danger-2" }}
{{ end }}
- + + aria-label="{{ tr "profile.template.form.name.aria-label" }}">
- + + aria-label="{{ tr "profile.template.form.handle.aria-label" }}">
@@ -66,7 +66,7 @@ type="submit" class="btn btn-primary btn-block btn-lg" > - Update profile + {{ tr "profile.template.form.button" }}
diff --git a/auth/assets/templates/request-password-reset.html.tpl b/auth/assets/templates/request-password-reset.html.tpl index 9accd2e55..bca3744fa 100644 --- a/auth/assets/templates/request-password-reset.html.tpl +++ b/auth/assets/templates/request-password-reset.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" . }}
-

Request password reset link

+

{{ tr "request_password_reset.template.title" }}

+ aria-label="{{ tr "request_password_reset.template.form.email.aria-label" }}">
- +
- Create new account - or - Log in + {{ tr "request_password_reset.template.new-acc-link" }} + {{ tr "request_password_reset.template.or" }} + {{ tr "request_password_reset.template.login" }}
{{ template "inc_footer.html.tpl" . }} diff --git a/auth/assets/templates/reset-password.html.tpl b/auth/assets/templates/reset-password.html.tpl index 7ee51b69e..e2250a296 100644 --- a/auth/assets/templates/reset-password.html.tpl +++ b/auth/assets/templates/reset-password.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" . }}
-

Reset your password

+

{{ tr "reset_password.template.title" }}

+ aria-label="{{ tr "reset_password.template.form.email.aria-label" }}">
+ placeholder="{{ tr "reset_password.template.form.new-password.placeholder" }}" + aria-label="{{ tr "reset_password.template.form.new-password.aria-label" }}">
- +
diff --git a/auth/assets/templates/security.html.tpl b/auth/assets/templates/security.html.tpl index 9b7021657..30a15b6bc 100644 --- a/auth/assets/templates/security.html.tpl +++ b/auth/assets/templates/security.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" set . "activeNav" "security" }}
-

Security

+

{{ tr "security.template.title" }}

{{ if .settings.LocalEnabled }} -
Password
- Change your password +
{{ tr "security.template.form.title" }}
+ {{ tr "security.template.form.passw-change" }} {{ end }}
{{ .csrfField }} -
Multi-factor authentication
+
{{ tr "security.template.security.title" }}
{{ if or .settings.MultiFactor.TOTP.Enabled .settings.MultiFactor.EmailOTP.Enabled }} {{ if .settings.MultiFactor.TOTP.Enabled }}
-
Additional security with mobile app (time-based one-time-password)
+
{{ tr "security.template.security.description" }}
{{ if .totpEnforced }} @@ -29,18 +29,18 @@ {{ end }} {{ if .totpEnforced }} - Configured and required on login. + {{ tr "security.template.security.req-login" }} {{ else }} - Currently disabled. + {{ tr "security.template.security.disable" }} {{ end }}
{{ if .totpEnforced }} {{ if not .settings.MultiFactor.TOTP.Enforced }} - + {{ end }} {{ else }} - + {{ end }}
@@ -49,7 +49,7 @@ {{ if .settings.MultiFactor.EmailOTP.Enabled }}
-
Additional security with one-time-password over email
+
{{ tr "security.template.aditional-security.title" }}
{{ if .emailOtpEnforced }} @@ -58,18 +58,18 @@ {{ end }} {{ if .emailOtpEnforced }} - Enabled and required on login. + {{ tr "security.template.aditional-security.email-otp-enforced" }} {{ else }} - Currently disabled. + {{ tr "security.template.aditional-security.disable" }} {{ end }}
{{ if .emailOtpEnforced }} {{ if not .settings.MultiFactor.EmailOTP.Enforced }} - + {{ end }} {{ else }} - + {{ end }}
@@ -78,7 +78,7 @@ {{ end }} {{ else }} {{ end }}
diff --git a/auth/assets/templates/sessions.html.tpl b/auth/assets/templates/sessions.html.tpl index 00b7eac67..461c0c3cb 100644 --- a/auth/assets/templates/sessions.html.tpl +++ b/auth/assets/templates/sessions.html.tpl @@ -1,7 +1,7 @@ {{ template "inc_header.html.tpl" set . "activeNav" "sessions" }}
-

Your sessions

+

{{ tr "session.template.title" }}

{{ if .sessions}} {{ end }}
@@ -23,7 +23,7 @@ {{ range .sessions}}
{{ if .Current }} -
Current session
+
{{ tr "session.template.form.title" }}
{{ end }} {{ if not .Current }} {{ end }} - +

- +

{{ .RemoteAddr }}

{{ if .SameRemoteAddr}} - This machine + {{ tr "session.template.form.span-machine" }} {{ end }} - +

{{ if .Expired }} - expired + {{ tr "session.template.form.label-expire.expired" }} {{ else if eq .ExpiresIn 0 }} - today + {{ tr "session.template.form.label-expire.today" }} {{ else if eq .ExpiresIn 1 }} - in 1 day + {{ tr "session.template.form.label-expire.when" }} {{ else }} in {{ .ExpiresIn }} days {{ end }} - +

{{ .UserAgent }}

{{ if .SameUserAgent}} - This browser + {{ tr "session.template.form.span-browser" }} {{ end }}
{{ end }} diff --git a/auth/assets/templates/signup.html.tpl b/auth/assets/templates/signup.html.tpl index 28c3de280..837dcad80 100644 --- a/auth/assets/templates/signup.html.tpl +++ b/auth/assets/templates/signup.html.tpl @@ -1,6 +1,6 @@ {{ template "inc_header.html.tpl" . }}
-

Sign up

+

{{ tr "singup.template.title" }}

+ aria-label="{{ tr "singup.template.form.email.aria-label" }}">
+ aria-label="{{ tr "singup.template.form.password.aria-label" }}">
+ aria-label="{{ tr "singup.template.form.name.aria-label" }}">
+ aria-label="{{ tr "singup.template.form.nickname.aria-label" }}">
+ >{{ tr "singup.template.form.button.sign-up" }}
-
Already have an account? - Log in here +
{{ tr "singup.template.form.link.alternative" }} + {{ tr "singup.template.form.link.login" }}
{{ template "inc_footer.html.tpl" . }} diff --git a/auth/handlers/handle_authorized-clients.go b/auth/handlers/handle_authorized-clients.go index d2b039a99..a31f77f2c 100644 --- a/auth/handlers/handle_authorized-clients.go +++ b/auth/handlers/handle_authorized-clients.go @@ -1,13 +1,14 @@ package handlers import ( - "github.com/cortezaproject/corteza-server/auth/request" - "github.com/cortezaproject/corteza-server/pkg/errors" - "github.com/cortezaproject/corteza-server/system/types" "sort" "strconv" "strings" "time" + + "github.com/cortezaproject/corteza-server/auth/request" + "github.com/cortezaproject/corteza-server/pkg/errors" + "github.com/cortezaproject/corteza-server/system/types" ) type ( @@ -59,9 +60,10 @@ func (h *AuthHandlers) clientsProc(req *request.AuthReq) error { return err } + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Client authorization deleted", + Text: t("authorized-clients.alerts.text"), }) } diff --git a/auth/handlers/handle_change-password.go b/auth/handlers/handle_change-password.go index bed131389..f7a759dcb 100644 --- a/auth/handlers/handle_change-password.go +++ b/auth/handlers/handle_change-password.go @@ -22,10 +22,12 @@ func (h *AuthHandlers) changePasswordProc(req *request.AuthReq) (err error) { req.Request.PostFormValue("newPassword"), ) + t := translator(req, "auth") + if err == nil { req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Password successfully changed.", + Text: t("change-password.alerts.text"), }) req.RedirectTo = GetLinks().Profile diff --git a/auth/handlers/handle_login.go b/auth/handlers/handle_login.go index 7b9b9016c..4b55daf3b 100644 --- a/auth/handlers/handle_login.go +++ b/auth/handlers/handle_login.go @@ -98,7 +98,9 @@ func (h *AuthHandlers) loginProc(req *request.AuthReq) (err error) { zap.Bool("perm-login", isPerm), zap.Duration("lifetime", lifetime), ) - req.PushAlert("You are now logged-in") + + t := translator(req, "auth") + req.PushAlert(t("login.alerts.logged-in")) if req.AuthUser.PendingEmailOTP() { // Email OTP enforced (globally or by user sec. policy) @@ -153,5 +155,7 @@ func (h *AuthHandlers) localDisabledAlert(req *request.AuthReq) { req.RedirectTo = GetLinks().Login } - req.PushDangerAlert("Local accounts disabled") + t := translator(req, "auth") + + req.PushDangerAlert(t("login.alert.local-disabled")) } diff --git a/auth/handlers/handle_mfa.go b/auth/handlers/handle_mfa.go index ad6fdcdd9..2536a8449 100644 --- a/auth/handlers/handle_mfa.go +++ b/auth/handlers/handle_mfa.go @@ -26,7 +26,9 @@ func (h AuthHandlers) mfaForm(req *request.AuthReq) (err error) { return nil } - req.PushAlert("Email OTP resent") + t := translator(req, "auth") + + req.PushAlert(t("mfa.handle.email-resent")) req.RedirectTo = GetLinks().Mfa } @@ -55,7 +57,9 @@ func (h AuthHandlers) mfaProc(req *request.AuthReq) (err error) { return nil } - req.PushAlert("Email OTP valid") + t := translator(req, "auth") + + req.PushAlert(t("mfa.handle.email-resent")) req.AuthUser.CompleteEmailOTP() case "verifyTotp": @@ -69,7 +73,9 @@ func (h AuthHandlers) mfaProc(req *request.AuthReq) (err error) { return nil } - req.PushAlert("TOTP valid") + t := translator(req, "auth") + + req.PushAlert(t("mfa.handle.topt-valid")) req.AuthUser.CompleteTOTP() } diff --git a/auth/handlers/handle_mfa_totp.go b/auth/handlers/handle_mfa_totp.go index 539096f41..09654e3da 100644 --- a/auth/handlers/handle_mfa_totp.go +++ b/auth/handlers/handle_mfa_totp.go @@ -3,13 +3,14 @@ package handlers import ( "encoding/base32" "fmt" + "math/rand" + "net/url" + "github.com/cortezaproject/corteza-server/auth/request" "github.com/cortezaproject/corteza-server/pkg/auth" "github.com/cortezaproject/corteza-server/pkg/errors" "github.com/cortezaproject/corteza-server/system/types" "go.uber.org/zap" - "math/rand" - "net/url" "rsc.io/qr" ) @@ -69,10 +70,11 @@ func (h AuthHandlers) mfaTotpConfigProc(req *request.AuthReq) (err error) { req.Request.PostFormValue("code"), ) + t := translator(req, "auth") if err == nil { req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Two factor authentication with TOTP enabled", + Text: t("mfa_totp.alerts.text-TFA-enabled"), }) // Make sure we update User's data in the session @@ -172,10 +174,11 @@ func (h AuthHandlers) mfaTotpDisableProc(req *request.AuthReq) (err error) { req.Request.PostFormValue("code"), ) + t := translator(req, "auth") if err == nil { req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Two factor authentication with TOTP disabled", + Text: t("mfa_totp.alerts.text-TFA_disabled"), }) // Make sure we update User's data in the session diff --git a/auth/handlers/handle_oauth2.go b/auth/handlers/handle_oauth2.go index d211932c3..2c2c90355 100644 --- a/auth/handlers/handle_oauth2.go +++ b/auth/handlers/handle_oauth2.go @@ -91,9 +91,11 @@ func (h AuthHandlers) oauth2AuthorizeClient(req *request.AuthReq) (err error) { request.SetOauth2Client(req.Session, nil) request.SetOauth2AuthParams(req.Session, nil) req.RedirectTo = GetLinks().Profile + + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "danger", - Text: fmt.Sprintf("cannot authorize '%s', no permissions.", req.Client), + Text: fmt.Sprintf(t("oauth2_authorize_client.alerts.no-auth-or-prems"), req.Client), }) return nil } @@ -140,9 +142,10 @@ func (h AuthHandlers) oauth2AuthorizeClientProc(req *request.AuthReq) (err error // request.SetOauth2AuthParams(req.Session, nil) req.RedirectTo = GetLinks().Profile + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "warning", - Text: "Access for client denied", + Text: t("oauth2_authorize_client.alerts.client-access-denied"), }) return } diff --git a/auth/handlers/handle_password-reset.go b/auth/handlers/handle_password-reset.go index 2df4f2d0a..1a4a81d65 100644 --- a/auth/handlers/handle_password-reset.go +++ b/auth/handlers/handle_password-reset.go @@ -67,9 +67,10 @@ func (h *AuthHandlers) resetPasswordForm(req *request.AuthReq) (err error) { h.Log.Warn("invalid password reset token used", zap.Error(err)) req.RedirectTo = GetLinks().RequestPasswordReset + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "warning", - Text: "Invalid or expired password reset token, please repeat password reset request.", + Text: t("password_reset_requested.alert.inv-exp-passw-token"), }) } @@ -83,9 +84,10 @@ func (h *AuthHandlers) resetPasswordProc(req *request.AuthReq) (err error) { err = h.AuthService.SetPassword(req.Context(), req.AuthUser.User.ID, req.Request.PostFormValue("password")) if err == nil { + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Password successfully reset.", + Text: t("password_reset_requested.alert.pass-reset-success"), }) req.RedirectTo = GetLinks().Profile @@ -116,8 +118,9 @@ func (h *AuthHandlers) onlyIfPasswordResetEnabled(fn handlerFn) handlerFn { func (h *AuthHandlers) passwordResetDisabledAlert(req *request.AuthReq) { req.RedirectTo = GetLinks().Login + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "danger", - Text: "Password reset disabled", + Text: t("password_reset_requested.alert.pass-reset-disabled"), }) } diff --git a/auth/handlers/handle_profile.go b/auth/handlers/handle_profile.go index 789b7bf38..729c8e93d 100644 --- a/auth/handlers/handle_profile.go +++ b/auth/handlers/handle_profile.go @@ -40,9 +40,10 @@ func (h *AuthHandlers) profileProc(req *request.AuthReq) error { req.AuthUser.User = user req.AuthUser.Save(req.Session) + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Profile successfully updated.", + Text: t("profile.alerts.profile-updated"), }) req.RedirectTo = GetLinks().Profile @@ -63,9 +64,10 @@ func (h *AuthHandlers) profileProc(req *request.AuthReq) error { "name": u.Name, }) + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "danger", - Text: "Could not update profile due to input errors", + Text: t("profile.alerts.profile-update-fail"), }) h.Log.Warn("handled error", zap.Error(err)) diff --git a/auth/handlers/handle_security.go b/auth/handlers/handle_security.go index c977b4561..ae6752620 100644 --- a/auth/handlers/handle_security.go +++ b/auth/handlers/handle_security.go @@ -35,9 +35,10 @@ func (h *AuthHandlers) securityProc(req *request.AuthReq) error { if user, err := h.AuthService.ConfigureEmailOTP(req.Context(), req.AuthUser.User.ID, enable); err != nil { return err } else { + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Two factor authentication with TOTP disabled", + Text: t("security.TFA-TOTP-disabled"), }) // Make sure we update User's data in the session diff --git a/auth/handlers/handle_sessions.go b/auth/handlers/handle_sessions.go index 3bfcbe8dc..466a55450 100644 --- a/auth/handlers/handle_sessions.go +++ b/auth/handlers/handle_sessions.go @@ -3,10 +3,11 @@ package handlers import ( "crypto/md5" "fmt" - "github.com/cortezaproject/corteza-server/auth/request" - "github.com/cortezaproject/corteza-server/system/types" "sort" "time" + + "github.com/cortezaproject/corteza-server/auth/request" + "github.com/cortezaproject/corteza-server/system/types" ) type ( @@ -74,9 +75,10 @@ func (h *AuthHandlers) sessionsProc(req *request.AuthReq) error { } } + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "All sessions but current deleted", + Text: t("session.alerts.delete-sessions-but-current"), }) case len(req.Request.PostFormValue("delete")) > 0: for _, s := range ss { @@ -89,9 +91,10 @@ func (h *AuthHandlers) sessionsProc(req *request.AuthReq) error { } } + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Session deleted", + Text: t("session.alerts.session-deleted"), }) } diff --git a/auth/handlers/handle_signup.go b/auth/handlers/handle_signup.go index ddd9540a0..b9af62ada 100644 --- a/auth/handlers/handle_signup.go +++ b/auth/handlers/handle_signup.go @@ -31,9 +31,10 @@ func (h *AuthHandlers) signupProc(req *request.AuthReq) error { if err == nil { if newUser.EmailConfirmed { + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Sign-up successful.", + Text: t("singup.alerts.singup-successful"), }) h.Log.Info( @@ -101,9 +102,10 @@ func (h *AuthHandlers) confirmEmail(req *request.AuthReq) (err error) { if err == nil { // redirect back to self (but without token and with user in session h.Log.Debug("valid email confirmation token found, redirecting to profile") + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "primary", - Text: "Email address confirmed, you're now logged-in.", + Text: t("singup.alerts.email-confirmed-logged-in"), }) req.RedirectTo = GetLinks().Profile @@ -130,9 +132,10 @@ func (h *AuthHandlers) confirmEmail(req *request.AuthReq) (err error) { req.RedirectTo = GetLinks().Profile } + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "warning", - Text: "Invalid or expired email confirmation token, please resend confirmation request.", + Text: t("singup.alerts.inv-or-exp-token"), }) return nil @@ -151,8 +154,9 @@ func (h *AuthHandlers) onlyIfSignupEnabled(fn handlerFn) handlerFn { func (h *AuthHandlers) signupDisabledAlert(req *request.AuthReq) { req.RedirectTo = GetLinks().Login + t := translator(req, "auth") req.NewAlerts = append(req.NewAlerts, request.Alert{ Type: "danger", - Text: "Signup disabled", + Text: t("singup.alerts.singup-disabled"), }) }