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}}
- Delete all sessions
+ {{ tr "session.template.button.delete-all" }}
{{ end }}
@@ -23,7 +23,7 @@
{{ range .sessions}}
{{ if .Current }}
-
Current session
+
{{ tr "session.template.form.title" }}
{{ end }}
{{ if not .Current }}
- Delete this session
+ {{ tr "session.template.button.delete-this" }}
{{ end }}
-
Authorized on
+
{{ tr "session.template.form.label-auth" }}
{{ .CreatedAt | date "Mon, 02 Jan 2006 15:04 MST" }}
-
IP Address
+
{{ tr "session.template.form.label-IP" }}
{{ .RemoteAddr }}
{{ if .SameRemoteAddr}}
-
This machine
+
{{ tr "session.template.form.span-machine" }}
{{ end }}
-
Expires
+
{{ tr "session.template.form.label-expire.title" }}
{{ .ExpiresAt | date "Mon, 02 Jan 2006 15:04 MST" }}
{{ 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 }}
-
Browser
+
{{ tr "session.template.form.label-browser" }}
{{ .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" }}
- Password *
+ {{ tr "singup.template.form.password.label" }}
+ aria-label="{{ tr "singup.template.form.password.aria-label" }}">
- Full Name
+ {{ tr "singup.template.form.name.label" }}
+ aria-label="{{ tr "singup.template.form.name.aria-label" }}">
- Short name, nickname or handle
+ {{ tr "singup.template.form.nickname.label" }}
+ aria-label="{{ tr "singup.template.form.nickname.aria-label" }}">
Submit
+ >{{ 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"),
})
}