Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Add 2FA TOTP support for authentication.

Kailash Nadh296245a1b3fe
diff --git a/cmd/auth.go b/cmd/auth.go
index 736bcccd..63bbef7a 100644
--- a/cmd/auth.go
+++ b/cmd/auth.go
@@ -6,23 +6,33 @@ import (
"encoding/json"
"errors"
"fmt"
+ "image/png"
"net/http"
"net/mail"
"net/url"
"strings"
- "sync"
"time"
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/internal/i18n"
"github.com/knadh/listmonk/internal/notifs"
+ "github.com/knadh/listmonk/internal/tmptokens"
"github.com/knadh/listmonk/internal/utils"
"github.com/knadh/listmonk/models"
"github.com/labstack/echo/v4"
+ "github.com/pquerna/otp/totp"
"github.com/zerodha/simplesessions/v3"
"gopkg.in/volatiletech/null.v6"
)
+const (
+ passwordResetTTL = 30 * time.Minute
+ twofaTokenTTL = 5 * time.Minute
+
+ // Length of reset and 2FA auth tokens.
+ tmpAuthTokenLen = 64
+)
+
type loginTpl struct {
Title string
Description string
@@ -40,12 +50,6 @@ type oidcState struct {
Next string `json:"next"`
}
-type resetEntry struct {
- Token string
- Email string
- Timestamp time.Time
-}
-
type forgotPasswordTpl struct {
Title string
Description string
@@ -60,6 +64,14 @@ type resetPasswordTpl struct {
Error string
}
+type twofaTpl struct {
+ Title string
+ Description string
+ Token string
+ NextURI string
+ Error string
+}
+
var (
oidcProviders = map[string]struct{}{
"google.com": {},
@@ -67,15 +79,8 @@ var (
"auth0.com": {},
"github.com": {},
}
-
- // In-memory map to store password reset tokens. This is a good-enough, simple implementation
- // that's a fair tradeoff compared to full fledged database state management for reset tokens.
- pwdResetTokens = make(map[string]resetEntry)
- resetMu sync.Mutex
)
-const passwordExpiryTTL = 30 * time.Minute
-
// LoginPage renders the login page and handles the login form.
func (a *App) LoginPage(c echo.Context) error {
// Has the user been setup?
@@ -118,6 +123,47 @@ func (a *App) LoginSetupPage(c echo.Context) error {
return a.renderLoginSetupPage(c, loginErr)
}
+// TwofaPage renders the 2FA verification page and handles the 2FA form submission.
+func (a *App) TwofaPage(c echo.Context) error {
+ var token, next string
+
+ if c.Request().Method == http.MethodPost {
+ token = strings.TrimSpace(c.FormValue("token"))
+ next = utils.SanitizeURI(c.FormValue("next"))
+ } else {
+ token = strings.TrimSpace(c.QueryParam("token"))
+ next = utils.SanitizeURI(c.QueryParam("next"))
+ }
+
+ // If there's no token, redirect.
+ if len(token) < tmpAuthTokenLen {
+ return c.Redirect(http.StatusFound, uriAdmin)
+ }
+
+ if next == "" || next == "/" {
+ next = uriAdmin
+ }
+
+ // Validate the 2FA temp token.
+ data, err := tmptokens.Check(token)
+ if err != nil {
+ return c.Redirect(http.StatusFound, uriAdmin)
+ }
+
+ userID, ok := data.(int)
+ if !ok {
+ return a.renderTwofaPage(c, token, next, a.i18n.T("users.invalidRequest"))
+ }
+
+ // Process the 2FA verification POST request.
+ if c.Request().Method == http.MethodPost {
+ return a.doTwofaVerify(c, token, userID, next)
+ }
+
+ // Render the 2FA verification page.
+ return a.renderTwofaPage(c, token, next, "")
+}
+
// Logout logs a user out.
func (a *App) Logout(c echo.Context) error {
// Delete the session from the DB and cookie.
@@ -225,6 +271,51 @@ func (a *App) OIDCFinish(c echo.Context) error {
return c.Redirect(http.StatusFound, utils.SanitizeURI(state.Next))
}
+// ForgotPage renders the forgot password page and handles the forgot password form.
+func (a *App) ForgotPage(c echo.Context) error {
+ // Process the forgot password request.
+ if c.Request().Method == http.MethodPost {
+ return a.doForgotPassword(c)
+ }
+
+ // Render the forgot page.
+ out := forgotPasswordTpl{Title: a.i18n.T("users.forgotPassword")}
+ return c.Render(http.StatusOK, "admin-forgot-password", out)
+}
+
+// ResetPage renders the reset password page and handles the reset password form.
+func (a *App) ResetPage(c echo.Context) error {
+ var (
+ token = strings.TrimSpace(c.QueryParam("token"))
+ email = strings.ToLower(strings.TrimSpace(c.QueryParam("email")))
+ )
+
+ // Validate token and email (don't delete it yet, as we may need it for POST).
+ data, err := tmptokens.Check(email)
+ if err != nil {
+ return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
+ }
+
+ tk, ok := data.(string)
+ if !ok || tk != token {
+ return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
+ }
+
+ // Validate that the user exists.
+ _, err = a.core.GetUser(0, "", email)
+ if err != nil {
+ return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
+ }
+
+ // Process the reset password request form with the new passwords.
+ if c.Request().Method == http.MethodPost {
+ return a.doResetPassword(c, token, email)
+ }
+
+ // Render the reset password form for GET request.
+ return a.renderResetPasswordPage(c, token, email, "")
+}
+
// renderLoginPage renders the login page and handles the login form.
func (a *App) renderLoginPage(c echo.Context, loginErr error) error {
next := utils.SanitizeURI(c.FormValue("next"))
@@ -383,6 +474,23 @@ func (a *App) doLogin(c echo.Context) error {
return err
}
+ // If TOTP is enabled for the user, create a temp token and redirect to the 2FA page.
+ if user.TwofaType == models.TwofaTypeTOTP {
+ // Generate a random token.
+ token, err := generateRandomString(tmpAuthTokenLen)
+ if err != nil {
+ a.log.Printf("error generating 2FA token: %v", err)
+ return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
+ }
+
+ // Set the token.
+ tmptokens.Set(token, twofaTokenTTL, user.ID)
+
+ // Redirect to 2FA page.
+ next := utils.SanitizeURI(c.FormValue("next"))
+ return c.Redirect(http.StatusFound, fmt.Sprintf("%s/login/twofa?token=%s&next=%s", uriAdmin, token, url.QueryEscape(next)))
+ }
+
// Set the session in the DB and cookie.
if err := a.auth.SaveSession(user, "", c); err != nil {
return err
@@ -458,61 +566,6 @@ func (a *App) doFirstTimeSetup(c echo.Context) error {
return nil
}
-// ForgotPage renders the forgot password page and handles the forgot password form.
-func (a *App) ForgotPage(c echo.Context) error {
- // Process the forgot password request.
- if c.Request().Method == http.MethodPost {
- return a.doForgotPassword(c)
- }
-
- // Render the forgot page.
- out := forgotPasswordTpl{Title: a.i18n.T("users.forgotPassword")}
- return c.Render(http.StatusOK, "admin-forgot-password", out)
-}
-
-// ResetPage renders the reset password page and handles the reset password form.
-func (a *App) ResetPage(c echo.Context) error {
- var (
- token = strings.TrimSpace(c.QueryParam("token"))
- email = strings.ToLower(strings.TrimSpace(c.QueryParam("email")))
- )
-
- // Validate token and email.
- resetMu.Lock()
- entry, exists := pwdResetTokens[email]
- resetMu.Unlock()
-
- if !exists || entry.Token != token {
- return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
- }
-
- // Check if the token has expired.
- if time.Since(entry.Timestamp) > passwordExpiryTTL {
- resetMu.Lock()
- delete(pwdResetTokens, email)
- resetMu.Unlock()
-
- return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
- }
-
- // Validate that the user exists.
- _, err := a.core.GetUser(0, "", email)
- if err != nil {
- resetMu.Lock()
- delete(pwdResetTokens, email)
- resetMu.Unlock()
- return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
- }
-
- // Process the reset password request form with the new passwords.
- if c.Request().Method == http.MethodPost {
- return a.doResetPassword(c, entry)
- }
-
- // Render the reset password form for GET request.
- return a.renderResetPasswordPage(c, token, email, "")
-}
-
// renderResetPasswordPage renders the reset password page.
func (a *App) renderResetPasswordPage(c echo.Context, token, email, errMsg string) error {
out := resetPasswordTpl{
@@ -547,20 +600,14 @@ func (a *App) doForgotPassword(c echo.Context) error {
}
// Generate a random token.
- token, err := generateRandomString(64)
+ token, err := generateRandomString(tmpAuthTokenLen)
if err != nil {
a.log.Printf("error generating reset token: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
}
- // Store the reset entry in the map.
- resetMu.Lock()
- pwdResetTokens[email] = resetEntry{
- Token: token,
- Email: email,
- Timestamp: time.Now(),
- }
- resetMu.Unlock()
+ // Store the reset token in tmptokens.
+ tmptokens.Set(email, passwordResetTTL, token)
// Prepare the reset URL.
resetURL := fmt.Sprintf("%s/admin/reset?token=%s&email=%s", a.urlCfg.RootURL, token, url.QueryEscape(email))
@@ -598,7 +645,7 @@ func (a *App) doForgotPassword(c echo.Context) error {
}
// doResetPassword handles the reset password form submission.
-func (a *App) doResetPassword(c echo.Context, r resetEntry) error {
+func (a *App) doResetPassword(c echo.Context, token, email string) error {
var (
password = c.FormValue("password")
password2 = c.FormValue("password2")
@@ -606,19 +653,26 @@ func (a *App) doResetPassword(c echo.Context, r resetEntry) error {
// Validate password.
if !strHasLen(password, 8, stdInputMaxLen) {
- return a.renderResetPasswordPage(c, r.Token, r.Email, a.i18n.Ts("globals.messages.invalidFields", "name", "password"))
+ return a.renderResetPasswordPage(c, token, email, a.i18n.Ts("globals.messages.invalidFields", "name", "password"))
}
if password != password2 {
- return a.renderResetPasswordPage(c, r.Token, r.Email, a.i18n.T("users.passwordMismatch"))
+ return a.renderResetPasswordPage(c, token, email, a.i18n.T("users.passwordMismatch"))
}
- // Get the user.
- user, err := a.core.GetUser(0, "", r.Email)
+ // Validate and consume the token (this deletes it).
+ data, err := tmptokens.Get(email)
if err != nil {
- resetMu.Lock()
- delete(pwdResetTokens, r.Email)
- resetMu.Unlock()
+ return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
+ }
+ tk, ok := data.(string)
+ if !ok || tk != token {
+ return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
+ }
+
+ // Get the user.
+ user, err := a.core.GetUser(0, "", email)
+ if err != nil {
return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("users.resetPassword"), "", a.i18n.T("users.invalidResetLink")))
}
@@ -633,11 +687,6 @@ func (a *App) doResetPassword(c echo.Context, r resetEntry) error {
return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
}
- // Clean up the reset token.
- resetMu.Lock()
- delete(pwdResetTokens, r.Email)
- resetMu.Unlock()
-
// Log the user in directly without forcing a manual login right after password change.
if err := a.auth.SaveSession(user, "", c); err != nil {
return err
@@ -646,3 +695,95 @@ func (a *App) doResetPassword(c echo.Context, r resetEntry) error {
// Redirect to the admin page.
return c.Redirect(http.StatusFound, uriAdmin)
}
+
+// renderTwofaPage renders the 2FA verification page.
+func (a *App) renderTwofaPage(c echo.Context, token, next, errMsg string) error {
+ out := twofaTpl{
+ Title: a.i18n.T("users.twoFA"),
+ Description: "",
+ Token: token,
+ NextURI: next,
+ Error: errMsg,
+ }
+ return c.Render(http.StatusOK, "admin-twofa", out)
+}
+
+// doTwofaVerify handles the 2FA verification form submission.
+func (a *App) doTwofaVerify(c echo.Context, token string, userID int, next string) error {
+ totpCode := strings.TrimSpace(c.FormValue("totp_code"))
+
+ // Validate.
+ if !strHasLen(totpCode, 6, 6) {
+ return a.renderTwofaPage(c, token, next, a.i18n.T("globals.messages.invalidValue"))
+ }
+
+ // Get the user.
+ user, err := a.core.GetUser(userID, "", "")
+ if err != nil {
+ return a.renderTwofaPage(c, token, next, a.i18n.T("users.invalidRequest"))
+ }
+
+ // Verify that TOTP is actually enabled for the user.
+ if user.TwofaType != models.TwofaTypeTOTP {
+ return a.renderTwofaPage(c, token, next, a.i18n.T("users.twoFANotEnabled"))
+ }
+
+ // Verify the TOTP code.
+ valid := totp.Validate(totpCode, user.TwofaKey.String)
+ if !valid {
+ return a.renderTwofaPage(c, token, next, a.i18n.T("globals.messages.invalidValue"))
+ }
+
+ // Invalidate the token.
+ tmptokens.Delete(token)
+
+ // Set the session.
+ if err := a.auth.SaveSession(user, "", c); err != nil {
+ return err
+ }
+
+ // Redirect to the next page.
+ return c.Redirect(http.StatusFound, next)
+}
+
+// GenerateTOTPQR generates a TOTP QR code for a user to scan with their authenticator app.
+func (a *App) GenerateTOTPQR(c echo.Context) error {
+ u := c.Get(auth.UserHTTPCtxKey).(auth.User)
+
+ // If TOTP is already enabled, don't generate a new key.
+ if u.TwofaType == models.TwofaTypeTOTP {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("users.twoFAAlreadyEnabled"))
+ }
+
+ // Generate a new TOTP key.
+ key, err := totp.Generate(totp.GenerateOpts{
+ Issuer: a.cfg.SiteName,
+ AccountName: u.Email.String,
+ })
+ if err != nil {
+ a.log.Printf("error generating TOTP key: %v", err)
+ return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
+ }
+
+ // Convert the TOTP key to a QR code image.
+ img, err := key.Image(200, 200)
+ if err != nil {
+ a.log.Printf("error generating QR code: %v", err)
+ return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
+ }
+
+ // Encode the QR code as a PNG and return it as base64.
+ var buf bytes.Buffer
+ if err := png.Encode(&buf, img); err != nil {
+ a.log.Printf("error encoding QR code: %v", err)
+ return echo.NewHTTPError(http.StatusInternalServerError, a.i18n.T("globals.messages.internalError"))
+ }
+
+ return c.JSON(http.StatusOK, okResp{struct {
+ Secret string `json:"secret"`
+ QR string `json:"qr"`
+ }{
+ Secret: key.Secret(),
+ QR: base64.StdEncoding.EncodeToString(buf.Bytes()),
+ }})
+}
diff --git a/cmd/handlers.go b/cmd/handlers.go
index 0ccb6359..a6b91103 100644
--- a/cmd/handlers.go
+++ b/cmd/handlers.go
@@ -201,6 +201,11 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
g.DELETE("/api/users/:id", pm(hasID(a.DeleteUser), "users:manage"))
g.POST("/api/logout", a.Logout)
+ // TOTP 2FA endpoints
+ g.GET("/api/users/:id/twofa/totp", hasID(a.GenerateTOTPQR))
+ g.PUT("/api/users/:id/twofa", hasID(a.EnableTOTP))
+ g.DELETE("/api/users/:id/twofa", hasID(a.DisableTOTP))
+
g.GET("/api/roles/users", pm(a.GetUserRoles, "roles:get"))
g.GET("/api/roles/lists", pm(a.GeListRoles, "roles:get"))
g.POST("/api/roles/users", pm(a.CreateUserRole, "roles:manage"))
@@ -234,6 +239,8 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
// Public admin endpoints (login page, OIDC endpoints, password reset).
g.GET(path.Join(uriAdmin, "/login"), a.LoginPage)
g.POST(path.Join(uriAdmin, "/login"), a.LoginPage)
+ g.GET(path.Join(uriAdmin, "/login/twofa"), a.TwofaPage)
+ g.POST(path.Join(uriAdmin, "/login/twofa"), a.TwofaPage)
g.GET(path.Join(uriAdmin, "/forgot"), a.ForgotPage)
g.POST(path.Join(uriAdmin, "/forgot"), a.ForgotPage)
g.GET(path.Join(uriAdmin, "/reset"), a.ResetPage)
diff --git a/cmd/users.go b/cmd/users.go
index eba13442..ee099e88 100644
--- a/cmd/users.go
+++ b/cmd/users.go
@@ -8,7 +8,9 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/internal/core"
"github.com/knadh/listmonk/internal/utils"
+ "github.com/knadh/listmonk/models"
"github.com/labstack/echo/v4"
+ "github.com/pquerna/otp/totp"
"gopkg.in/volatiletech/null.v6"
)
@@ -267,6 +269,72 @@ func (a *App) UpdateUserProfile(c echo.Context) error {
return c.JSON(http.StatusOK, okResp{out})
}
+// EnableTOTP enables TOTP 2FA for a user after verifying the code.
+func (a *App) EnableTOTP(c echo.Context) error {
+ var (
+ u = c.Get(auth.UserHTTPCtxKey).(auth.User)
+ secret = strings.TrimSpace(c.FormValue("secret"))
+ code = strings.TrimSpace(c.FormValue("code"))
+ )
+
+ if secret == "" || code == "" {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("globals.messages.invalidFields"))
+ }
+
+ // If password login is disabled, can't enable TOTP.
+ if !u.PasswordLogin {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("public.invalidFeature"))
+ }
+
+ // If TOTP is already enabled, don't allow re-enabling.
+ if u.TwofaType == models.TwofaTypeTOTP {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("users.twoFAAlreadyEnabled"))
+ }
+
+ // Verify the TOTP code.
+ valid := totp.Validate(code, secret)
+ if !valid {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("users.invalidTOTPCode"))
+ }
+
+ // Enable TOTP in the DB.
+ if err := a.core.SetTwoFA(u.ID, models.TwofaTypeTOTP, secret); err != nil {
+ return err
+ }
+
+ return c.JSON(http.StatusOK, okResp{true})
+}
+
+// DisableTOTP disables TOTP 2FA for a user after verifying the password.
+func (a *App) DisableTOTP(c echo.Context) error {
+ var (
+ u = c.Get(auth.UserHTTPCtxKey).(auth.User)
+ password = c.FormValue("password")
+ )
+
+ // TOTP isn't enabled.
+ if u.TwofaType != models.TwofaTypeTOTP {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("users.twoFANotEnabled"))
+ }
+
+ // Validate password.
+ if !strHasLen(password, 8, stdInputMaxLen) {
+ return echo.NewHTTPError(http.StatusBadRequest, a.i18n.Ts("globals.messages.invalidFields", "name", "password"))
+ }
+
+ // Verify the password.
+ if _, err := a.core.LoginUser(u.Username, password); err != nil {
+ return echo.NewHTTPError(http.StatusForbidden, a.i18n.T("users.invalidPassword"))
+ }
+
+ // Disable TOTP in the DB.
+ if err := a.core.SetTwoFA(u.ID, models.TwofaTypeNone, ""); err != nil {
+ return err
+ }
+
+ return c.JSON(http.StatusOK, okResp{true})
+}
+
// cacheUsers fetches (API) users and caches them in the auth module.
// It also returns a bool indicating whether there are any actual users in the DB at all,
// which if there aren't, the first time user setup needs to be run.
diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js
index 7829ba3a..65df29f8 100644
--- a/frontend/src/api/index.js
+++ b/frontend/src/api/index.js
@@ -542,3 +542,19 @@ export const deleteRole = (id) => http.delete(
`/api/roles/${id}`,
{ loading: models.userRoles },
);
+
+// TOTP 2FA APIs
+export const getTOTPQR = (id) => http.get(
+ `/api/users/${id}/twofa/totp`,
+ { camelCase: true },
+);
+
+export const enableTOTP = (id, data) => http.put(
+ `/api/users/${id}/twofa`,
+ data,
+);
+
+export const disableTOTP = (id, data) => http.delete(
+ `/api/users/${id}/twofa`,
+ { data },
+);
diff --git a/frontend/src/views/UserProfile.vue b/frontend/src/views/UserProfile.vue
index abca2f4e..e0b5c71d 100644
--- a/frontend/src/views/UserProfile.vue
+++ b/frontend/src/views/UserProfile.vue
@@ -38,20 +38,114 @@
</b-button>
</b-field>
</form>
+
+ <br /><br />
+
+ <!-- 2FA -->
+ <section v-if="this.data.passwordLogin" class="twofa-section">
+ <!-- TOTP disabled -->
+ <div v-if="data.twofaType === 'none'" class="box">
+ <div class="columns is-vcentered mb-4">
+ <div class="column">
+ <h3 class="title is-size-5 mb-0">{{ $t('users.twoFA') }}</h3>
+ </div>
+ <div class="column is-narrow">
+ <b-switch v-if="!isTotpVisible" v-model="twofaEnabled" @input="onToggleEnableTotp" />
+ </div>
+ </div>
+
+ <p>{{ $t('users.twoFANotEnabled') }}</p>
+ <br />
+
+ <!-- TOTP setup -->
+ <div v-if="isTotpVisible" class="totp-setup">
+ <div v-if="totpQR" class="qr-section">
+ <p class="has-text-grey">{{ $t('users.totpScanQR') }}</p><br />
+
+ <img :src="'data:image/png;base64,' + totpQR" alt="QR Code" />
+
+ <br /><br />
+ <p>
+ <strong>{{ $t('users.totpSecret') }}</strong><br />
+ <code><copy-text :text="`${totpSecret}`" /></code>
+ </p>
+
+ <br /><br />
+ <form @submit.prevent="confirmTOTP">
+ <b-field :label="$t('users.totpCode')" label-position="on-border">
+ <b-input ref="totpCodeInput" v-model="totpCode" maxlength="6" pattern="[0-9]{6}" placeholder="000000"
+ required />
+ </b-field>
+ <div class="buttons">
+ <b-button type="is-primary" native-type="submit">
+ {{ $t('globals.buttons.enable') }}
+ </b-button>
+ <b-button type="button" @click="onCancelTOTPSetup">
+ {{ $t('globals.buttons.cancel') }}
+ </b-button>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+
+ <!-- TOTP Enabled -->
+ <div v-if="data.twofaType === 'totp'" class="box">
+ <div class="columns is-vcentered">
+ <div class="column">
+ <h3 class="title is-size-5">
+ <b-icon icon="check-circle-outline" type="is-success" /> {{ $t('users.twoFAEnabled') }}
+ </h3>
+ </div>
+ <div class="column is-narrow">
+ <b-switch v-if="!showDisableTOTP" v-model="twofaEnabled" @input="toggleDisableTOTP" />
+ </div>
+ </div>
+
+ <p>{{ $t('users.twoFAEnabledDesc', { type: data.twofaType.toUpperCase() }) }}</p>
+
+ <!-- Disable TOTP Flow -->
+ <form v-if="showDisableTOTP" class="disable-totp mt-5" @submit.prevent="confirmDisableTOTP">
+ <b-field :label="$t('users.password')" label-position="on-border">
+ <b-input ref="disablePasswordInput" v-model="disableTOTPPassword" type="password" minlength="8" required />
+ </b-field>
+ <div class="buttons">
+ <b-button type="is-danger" native-type="submit">
+ {{ $t('globals.buttons.disable') }}
+ </b-button>
+ <b-button type="button" @click="onCancelTOTPSetup">
+ {{ $t('globals.buttons.cancel') }}
+ </b-button>
+ </div>
+ </form>
+ </div>
+ </section>
</section>
</template>
<script>
import Vue from 'vue';
import { mapState } from 'vuex';
+import CopyText from '../components/CopyText.vue';
export default Vue.extend({
name: 'UserProfile',
+ components: {
+ CopyText,
+ },
+
data() {
return {
form: {},
data: {},
+ isTotpVisible: false,
+ totpQR: null,
+ totpSecret: null,
+ totpCode: '',
+ showDisableTOTP: false,
+ disableTOTPPassword: '',
+ twofaEnabled: false,
};
},
@@ -78,12 +172,101 @@ export default Vue.extend({
this.$utils.toast(this.$t('globals.messages.updated', { name: this.data.username }));
});
},
+
+ onToggleEnableTotp() {
+ this.$api.getTOTPQR(this.data.id).then((data) => {
+ this.totpQR = data.qr;
+ this.totpSecret = data.secret;
+ this.isTotpVisible = true;
+
+ this.$nextTick(() => {
+ if (this.$refs.totpCodeInput) {
+ this.$refs.totpCodeInput.focus();
+ }
+ });
+ }).catch(() => {
+ this.$utils.toast(this.$t('globals.messages.errorFetching'), 'is-danger');
+ });
+ },
+
+ onCancelTOTPSetup() {
+ this.isTotpVisible = false;
+ this.totpQR = null;
+ this.totpSecret = null;
+ this.totpCode = '';
+ this.twofaEnabled = this.data.twofaType === 'totp';
+ this.showDisableTOTP = false;
+ this.disableTOTPPassword = '';
+ },
+
+ confirmTOTP() {
+ if (!this.totpCode || this.totpCode.length !== 6) {
+ this.$utils.toast(this.$t('globals.messages.invalidValue'), 'is-danger');
+ return;
+ }
+
+ const d = new FormData();
+ d.append('secret', this.totpSecret);
+ d.append('code', this.totpCode);
+
+ this.$api.enableTOTP(this.data.id, d).then(() => {
+ this.$utils.toast(this.$t('users.twoFAEnabled'));
+ this.onCancelTOTPSetup();
+
+ // Reload user profile
+ this.$api.getUserProfile().then((data) => {
+ this.data = { ...data };
+ this.twofaEnabled = data.twofaType === 'totp';
+ });
+ }).catch(() => {
+ this.$utils.toast(this.$t('globals.messages.invalidValue'), 'is-danger');
+ });
+ },
+
+ toggleDisableTOTP() {
+ this.showDisableTOTP = true;
+
+ this.$nextTick(() => {
+ if (this.$refs.disablePasswordInput) {
+ this.$refs.disablePasswordInput.focus();
+ }
+ });
+ },
+
+ cancelDisableTOTP() {
+ this.showDisableTOTP = false;
+ this.disableTOTPPassword = '';
+ },
+
+ confirmDisableTOTP() {
+ if (!this.disableTOTPPassword) {
+ this.$utils.toast(this.$t('globals.messages.invalidFields'), 'is-danger');
+ return;
+ }
+
+ const formData = new FormData();
+ formData.append('password', this.disableTOTPPassword);
+
+ this.$api.disableTOTP(this.data.id, formData).then(() => {
+ this.$utils.toast(this.$t('globals.messages.done'));
+ this.showDisableTOTP = false;
+ this.disableTOTPPassword = '';
+ // Reload user profile
+ this.$api.getUserProfile().then((data) => {
+ this.data = { ...data };
+ this.twofaEnabled = data.twofaType === 'totp';
+ });
+ }).catch(() => {
+ this.$utils.toast(this.$t('users.invalidPassword'), 'is-danger');
+ });
+ },
},
mounted() {
this.$api.getUserProfile().then((data) => {
this.data = { ...data };
this.form = { name: data.name, email: data.email };
+ this.twofaEnabled = data.twofaType === 'totp';
});
},
diff --git a/go.mod b/go.mod
index fbbee247..84c28398 100644
--- a/go.mod
+++ b/go.mod
@@ -45,6 +45,7 @@ require (
dario.cat/mergo v1.0.2 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
+ github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
@@ -57,6 +58,7 @@ require (
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
+ github.com/pquerna/otp v1.5.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.9.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
diff --git a/go.sum b/go.sum
index 0be4a3f2..7a542a64 100644
--- a/go.sum
+++ b/go.sum
@@ -10,6 +10,8 @@ github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/altcha-org/altcha-lib-go v0.2.2 h1:KY7a7jFUf6tFKZF6MzuZMhSWuGMv0MtVkK/Kj4Oas38=
github.com/altcha-org/altcha-lib-go v0.2.2/go.mod h1:I8ESLVWR9C58uvGufB/AJDPhaSU4+4Oh3DLpVtgwDAk=
+github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
+github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk=
github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -106,6 +108,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pquerna/otp v1.5.0 h1:NMMR+WrmaqXU4EzdGJEE1aUUI0AMRzsp96fFFWNPwxs=
+github.com/pquerna/otp v1.5.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/rhnvrm/simples3 v0.9.1 h1:pYfEe2wTjx8B2zFzUdy4kZn3I3Otd9ZvzIhHkFR85kE=
github.com/rhnvrm/simples3 v0.9.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
@@ -119,6 +123,7 @@ github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
diff --git a/i18n/bg.json b/i18n/bg.json
index 5d5d2d37..a865edb9 100644
--- a/i18n/bg.json
+++ b/i18n/bg.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Копиране",
"globals.buttons.delete": "Изтриване",
"globals.buttons.deleteAll": "Изтриване на всички",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Редактиране",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Активирано",
"globals.buttons.insert": "Вмъкване",
"globals.buttons.learnMore": "Научете повече",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Невалидни полета: {name}",
"globals.messages.invalidID": "Невалидно ID(и)",
"globals.messages.invalidUUID": "Невалиден UUID(и)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Липсващи полета: {name}",
"globals.messages.notFound": "{name} не е намерен",
"globals.messages.numSelected": "{num} избрани",
@@ -634,6 +637,7 @@
"users.firstTime": "Това е нова инсталация. Изберете потребителско име и парола за акаунта на Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Невалидно потребителско име или парола",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Невалидна заявка за удостоверяване",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Последно влизане",
@@ -662,6 +666,15 @@
"users.roles": "Роли",
"users.status.disabled": "Деактивиран",
"users.status.enabled": "Активиран",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Тип",
"users.type.api": "API",
"users.type.super": "Супер Админ",
diff --git a/i18n/ca.json b/i18n/ca.json
index 5824227d..705c2867 100644
--- a/i18n/ca.json
+++ b/i18n/ca.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiar",
"globals.buttons.delete": "Esborra",
"globals.buttons.deleteAll": "Esborra tot",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Edita",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Habilitat",
"globals.buttons.insert": "Inserta",
"globals.buttons.learnMore": "Saber-nes més",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Camps no vàlids: {name}",
"globals.messages.invalidID": "ID(s) no vàlid",
"globals.messages.invalidUUID": "UUID(s) no vàlid",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Falten camps: {name}",
"globals.messages.notFound": "No s'ha trobat {name} ",
"globals.messages.numSelected": "{num} seleccionats",
@@ -634,6 +637,7 @@
"users.firstTime": "Aquesta és una nova instal·lació. Trieu un nom d'usuari i una contrasenya per al compte d'Administrador Super.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Inici de sessió o contrasenya no vàlids",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Sol·licitud d'autenticació no vàlida",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Últim inici de sessió",
@@ -662,6 +666,15 @@
"users.roles": "Rols",
"users.status.disabled": "Deshabilitat",
"users.status.enabled": "Habilitat",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipus",
"users.type.api": "API d'usuari",
"users.type.super": "Super Administrador",
diff --git a/i18n/cs-cz.json b/i18n/cs-cz.json
index 601566fe..929126ea 100644
--- a/i18n/cs-cz.json
+++ b/i18n/cs-cz.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopírovat",
"globals.buttons.delete": "Odstranit",
"globals.buttons.deleteAll": "Odstranit vše",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Upravit",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Povoleno",
"globals.buttons.insert": "Vložit",
"globals.buttons.learnMore": "Další informace",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Neplatné pole: {name}",
"globals.messages.invalidID": "Neplatné ID",
"globals.messages.invalidUUID": "Neplatné UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Chybějící pole: {name}",
"globals.messages.notFound": "{name} nebyl nalezen",
"globals.messages.numSelected": "{num} vybráno",
@@ -634,6 +637,7 @@
"users.firstTime": "Toto je čerstvá instalace. Vyberte si uživatelské jméno a heslo pro účet Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Neplatné přihlášení nebo heslo",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Neplatný požadavek ověření",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Poslední přihlášení",
@@ -662,6 +666,15 @@
"users.roles": "Role",
"users.status.disabled": "Deaktivované",
"users.status.enabled": "Povolené",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Typ",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/cy.json b/i18n/cy.json
index 9511ef4c..0c5d2979 100644
--- a/i18n/cy.json
+++ b/i18n/cy.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copïwch",
"globals.buttons.delete": "Dileu",
"globals.buttons.deleteAll": "Dileu'r cyfan",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Golygu",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Wedi galluogi",
"globals.buttons.insert": "Mewnosod",
"globals.buttons.learnMore": "Dysgu mwy",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Meysydd annilys: {name}",
"globals.messages.invalidID": "ID annilys",
"globals.messages.invalidUUID": "UUID annilys",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Maes/meysydd coll: {name}",
"globals.messages.notFound": "Heb ddod o hyd i {enw]",
"globals.messages.numSelected": "{num} wedi'u dewis",
@@ -634,6 +637,7 @@
"users.firstTime": "Dyma osodiad ffres. Dewiswch enw defnyddiwr a chyfrinair ar gyfer cyfrif Yr Uwch Weinydd.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Mewngofnodi neu gyfrinair annilys",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Cais dilys annilys",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Mewngofnodi diwethaf",
@@ -662,6 +666,15 @@
"users.roles": "Rolau",
"users.status.disabled": "Analluog",
"users.status.enabled": "Galluog",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Math",
"users.type.api": "API",
"users.type.super": "Uwch Weinydd",
diff --git a/i18n/da.json b/i18n/da.json
index 5550b5d6..a33c4c99 100644
--- a/i18n/da.json
+++ b/i18n/da.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopier",
"globals.buttons.delete": "Slet",
"globals.buttons.deleteAll": "Slet alle",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Redigere",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Aktiveret",
"globals.buttons.insert": "Indsætte",
"globals.buttons.learnMore": "Lær mere",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Ugyldige felter: {name}",
"globals.messages.invalidID": "Ugyldige ID'er",
"globals.messages.invalidUUID": "Ugyldig(e) UUID(s)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Manglende felt(er): {name}",
"globals.messages.notFound": "{name} ikke fundet",
"globals.messages.numSelected": "{num} valgt",
@@ -634,6 +637,7 @@
"users.firstTime": "Dette er en ny installation. Vælg et brugernavn og adgangskode til Super Admin-kontoen.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Ugyldig login eller adgangskode",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Ugyldig godkendelsesanmodning",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Sidste login",
@@ -662,6 +666,15 @@
"users.roles": "Roller",
"users.status.disabled": "Deaktiveret",
"users.status.enabled": "Aktiveret",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Type",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/de.json b/i18n/de.json
index 23ab3ee5..0e726496 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopieren",
"globals.buttons.delete": "Löschen",
"globals.buttons.deleteAll": "Alle Löschen",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Bearbeiten",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Aktiviert",
"globals.buttons.insert": "Einfügen",
"globals.buttons.learnMore": "Erfahre mehr",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Ungültige Felder: {name}",
"globals.messages.invalidID": "Ungültige ID",
"globals.messages.invalidUUID": "Ungültige UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Fehlende Felder: {name}",
"globals.messages.notFound": "{name} nicht gefunden",
"globals.messages.numSelected": "{num} ausgewählt",
@@ -634,6 +637,7 @@
"users.firstTime": "Dies ist eine neue Installation. Wählen Sie einen Benutzernamen und ein Passwort für das Super Admin-Konto.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Ungültige Anmeldung oder falsches Passwort",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Ungültige Auth-Anforderung",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Letzte Anmeldung",
@@ -662,6 +666,15 @@
"users.roles": "Rollen",
"users.status.disabled": "Deaktiviert",
"users.status.enabled": "Aktiviert",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Typ",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/el.json b/i18n/el.json
index 9aecbc4c..cb565f51 100644
--- a/i18n/el.json
+++ b/i18n/el.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Αντιγραφή",
"globals.buttons.delete": "Διαγραφή",
"globals.buttons.deleteAll": "Διαγραφή όλων",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Επεξεργασία",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Ενεργοποιημένο",
"globals.buttons.insert": "Εισαγωγή",
"globals.buttons.learnMore": "Μάθετε περισσότερα",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Μη έγκυρα πεδία: {name}",
"globals.messages.invalidID": "Μυ έγκυρο/-α ID",
"globals.messages.invalidUUID": "Μυ έγκυρο/-α UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Λείπουν πεδία: {name}",
"globals.messages.notFound": "Το {name} δεν βρέθηκε",
"globals.messages.numSelected": "{num} επιλεγμένα",
@@ -634,6 +637,7 @@
"users.firstTime": "Αυτή είναι μια καινούργια εγκατάσταση. Επιλέξτε ένα όνομα χρήστη και έναν κωδικό πρόσβασης για τον υπερδιαχειριστή του συστήματος.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Μη έγκυρη σύνδεση ή κωδικός πρόσβασης",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Μη έγκυρο αίτημα εξουσιοδότησης",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Τελευταία σύνδεση",
@@ -662,6 +666,15 @@
"users.roles": "Ρόλοι",
"users.status.disabled": "Απενεργοποιημένο",
"users.status.enabled": "Ενεργοποιημένο",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Τύπος",
"users.type.api": "API",
"users.type.super": "Υπερδιαχειριστής",
diff --git a/i18n/en.json b/i18n/en.json
index 453283dd..9e836bf0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -142,6 +142,8 @@
"globals.buttons.clone": "Clone",
"globals.buttons.close": "Close",
"globals.buttons.continue": "Continue",
+ "globals.buttons.enable": "Enable",
+ "globals.buttons.disable": "Disable",
"globals.buttons.copy": "Copy",
"globals.buttons.delete": "Delete",
"globals.buttons.deleteAll": "Delete all",
@@ -191,6 +193,7 @@
"globals.messages.errorUpdating": "Error updating {name}: {error}",
"globals.messages.internalError": "Internal server error",
"globals.messages.invalidData": "Invalid data",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.invalidFields": "Invalid fields: {name}",
"globals.messages.invalidID": "Invalid ID(s)",
"globals.messages.invalidUUID": "Invalid UUID(s)",
@@ -669,5 +672,15 @@
"email.forgotPassword.button": "Reset password",
"email.forgotPassword.info": "If you didn't request this, you can safely ignore this email. This link will expire in 30 minutes.",
"settings.security.CORSDomains": "Allowed origins",
- "settings.security.CORSDomainsHelp": "Permit accessing API endpoints via browser Javascript from external domains. Enter one domain per line (e.g: https://example.com). Leave empty to disable CORS or add * to allow all (not recommended)."
+ "settings.security.CORSDomainsHelp": "Permit accessing API endpoints via browser Javascript from external domains. Enter one domain per line (e.g: https://example.com). Leave empty to disable CORS or add * to allow all (not recommended).",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.invalidPassword": "Invalid password"
}
diff --git a/i18n/eo.json b/i18n/eo.json
index 6c24c1c7..bb4b38f7 100644
--- a/i18n/eo.json
+++ b/i18n/eo.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiar",
"globals.buttons.delete": "Esborra",
"globals.buttons.deleteAll": "Esborra tot",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Edita",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Habilitat",
"globals.buttons.insert": "Inserta",
"globals.buttons.learnMore": "Saber-nes més",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Camps no vàlids: {name}",
"globals.messages.invalidID": "ID(s) no vàlid",
"globals.messages.invalidUUID": "UUID(s) no vàlid",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Falten camps: {name}",
"globals.messages.notFound": "No s'ha trobat {name} ",
"globals.messages.numSelected": "{num} elektitaj",
@@ -634,6 +637,7 @@
"users.firstTime": "Ĉi tio estas nova instalo. Elektu uzantonomon kaj pasvorton por la Super Admin-konto.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Nevalida ensaluto aŭ pasvorto",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Nevalida aŭtentiga peto",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Lasta ensaluto",
@@ -662,6 +666,15 @@
"users.roles": "Roloj",
"users.status.disabled": "Malaktiva",
"users.status.enabled": "Aktiva",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipo",
"users.type.api": "API",
"users.type.super": "Supa Admin",
diff --git a/i18n/es.json b/i18n/es.json
index c9c52cb6..022eb67c 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiar",
"globals.buttons.delete": "Eliminar",
"globals.buttons.deleteAll": "Eliminar todos",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Editar",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Habilitar",
"globals.buttons.insert": "Insertar",
"globals.buttons.learnMore": "Conocer más",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Campos inválidos: {name}",
"globals.messages.invalidID": "ID inválido",
"globals.messages.invalidUUID": "UUID inválido",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Falta el campo(s): {name}",
"globals.messages.notFound": "{name} no encontrado",
"globals.messages.numSelected": "{num} seleccionados",
@@ -634,6 +637,7 @@
"users.firstTime": "Esta es una instalación nueva. Elija un nombre de usuario y una contraseña para la cuenta de superadmin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Inicio de sesión o contraseña no válidos",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Solicitud de autenticación no válida",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Último inicio de sesión",
@@ -662,6 +666,15 @@
"users.roles": "Roles",
"users.status.disabled": "Desactivado",
"users.status.enabled": "Habilitado",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipo",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/fi.json b/i18n/fi.json
index 903f6c26..4c612d89 100644
--- a/i18n/fi.json
+++ b/i18n/fi.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopioi",
"globals.buttons.delete": "Poista",
"globals.buttons.deleteAll": "Poista kaikki",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Muokkaa",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Käytössä",
"globals.buttons.insert": "Lisää",
"globals.buttons.learnMore": "Lue lisää",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Virheelliset kentät: {name}",
"globals.messages.invalidID": "Virheelliset ID:t",
"globals.messages.invalidUUID": "Virheelliset UUID:t",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Puuttuvat kentät: {name}",
"globals.messages.notFound": "{name} ei löytynyt",
"globals.messages.numSelected": "{num} valittuna",
@@ -634,6 +637,7 @@
"users.firstTime": "Tämä on tuore asennus. Valitse käyttäjänimi ja salasana Super Admin-tilille.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Virheellinen käyttäjänimi tai salasana",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Virheellinen todennuspyyntö",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Viimeisin kirjautuminen",
@@ -662,6 +666,15 @@
"users.roles": "Roolit",
"users.status.disabled": "Poistettu käytöstä",
"users.status.enabled": "Käytössä",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tyyppi",
"users.type.api": "API",
"users.type.super": "Ylin ylläpitäjä",
diff --git a/i18n/fr-CA.json b/i18n/fr-CA.json
index 27601829..e5c78efa 100644
--- a/i18n/fr-CA.json
+++ b/i18n/fr-CA.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copier",
"globals.buttons.delete": "Supprimer",
"globals.buttons.deleteAll": "Tout effacer",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Éditer",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Activé",
"globals.buttons.insert": "Insérer",
"globals.buttons.learnMore": "En savoir plus",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Champs non valides : {name}",
"globals.messages.invalidID": "ID invalide",
"globals.messages.invalidUUID": "UUID invalide",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Champ(s) manquant(s) : {name}",
"globals.messages.notFound": "{name} introuvable",
"globals.messages.numSelected": "{num} sélectionné(s)",
@@ -634,6 +637,7 @@
"users.firstTime": "Ceci est une nouvelle installation. Choisissez un nom d'utilisateur et un mot de passe pour le compte Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Identifiant ou mot de passe invalide",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Requête d'authentification invalide",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Dernière connexion",
@@ -662,6 +666,15 @@
"users.roles": "Rôles",
"users.status.disabled": "Désactivé",
"users.status.enabled": "Activé",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Type",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/fr.json b/i18n/fr.json
index e1bd2734..63d9d996 100644
--- a/i18n/fr.json
+++ b/i18n/fr.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copier",
"globals.buttons.delete": "Supprimer",
"globals.buttons.deleteAll": "Tout effacer",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Éditer",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Activé",
"globals.buttons.insert": "Insérer",
"globals.buttons.learnMore": "En savoir plus",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Champs non valides : {name}",
"globals.messages.invalidID": "ID invalide",
"globals.messages.invalidUUID": "UUID invalide",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Champ(s) manquant(s) : {name}",
"globals.messages.notFound": "{name} introuvable",
"globals.messages.numSelected": "{num} sélectionné(s)",
@@ -634,6 +637,7 @@
"users.firstTime": "Il s'agit d'une nouvelle installation. Choisissez un nom d'utilisateur et un mot de passe pour le compte Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Identifiant ou mot de passe incorrect",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Demande d'authentification invalide",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Dernière connexion",
@@ -662,6 +666,15 @@
"users.roles": "Rôles",
"users.status.disabled": "Désactivé",
"users.status.enabled": "Activé",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Type",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/he.json b/i18n/he.json
index 9462fa99..062e18e9 100644
--- a/i18n/he.json
+++ b/i18n/he.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "העתק",
"globals.buttons.delete": "מחיקה",
"globals.buttons.deleteAll": "מחק הכל",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "עריכה",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "מופעל",
"globals.buttons.insert": "להכניס",
"globals.buttons.learnMore": "למד עוד",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "שדות לא חוקיים: {name}",
"globals.messages.invalidID": "מזהים לא חוקיים",
"globals.messages.invalidUUID": "UUID לא תקין (ים)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "חסרים שדות: {name}",
"globals.messages.notFound": "{name} לא נמצא",
"globals.messages.numSelected": "{num} נבחרו",
@@ -634,6 +637,7 @@
"users.firstTime": "זוהי התקנה חדשה. בחר שם משתמש וסיסמה לחשבון הניהול העליון.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "התחברות או סיסמה לא תקינים",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "בקשת אימות לא חוקית",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "התחברות אחרונה",
@@ -662,6 +666,15 @@
"users.roles": "תפקידים",
"users.status.disabled": "מנוטרל",
"users.status.enabled": "מאופשר",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "סוג",
"users.type.api": "API",
"users.type.super": "מנהל עליון",
diff --git a/i18n/hu.json b/i18n/hu.json
index bd122dd6..425abf2f 100644
--- a/i18n/hu.json
+++ b/i18n/hu.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Másolás",
"globals.buttons.delete": "Törlés",
"globals.buttons.deleteAll": "Összes törlése",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Szerkesztés",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Engedélyezve",
"globals.buttons.insert": "Beszúrás",
"globals.buttons.learnMore": "Tudj meg többet",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Érvénytelen mező(k): {name}",
"globals.messages.invalidID": "Érvénytelen azonosító(k)",
"globals.messages.invalidUUID": "Érvénytelen UUID(-k)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Hiányzó mező(k): {name}",
"globals.messages.notFound": "{name} nem található",
"globals.messages.numSelected": "{num} kiválasztva",
@@ -634,6 +637,7 @@
"users.firstTime": "Ez egy friss telepítés. Válasszon felhasználónevet és jelszót a Super Admin fiókhoz.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Érvénytelen bejelentkezési név vagy jelszó",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Érvénytelen hitelesítési kérelem",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Utolsó bejelentkezés",
@@ -662,6 +666,15 @@
"users.roles": "Szerepkörök",
"users.status.disabled": "Letiltva",
"users.status.enabled": "Engedélyezve",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Típus",
"users.type.api": "API",
"users.type.super": "Szuper rendszergazda",
diff --git a/i18n/it.json b/i18n/it.json
index 14ac0b98..1471140e 100644
--- a/i18n/it.json
+++ b/i18n/it.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copia",
"globals.buttons.delete": "Cancellare",
"globals.buttons.deleteAll": "Cancellare tutto",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Modifica",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Attivata",
"globals.buttons.insert": "Inserire",
"globals.buttons.learnMore": "Per saperne di più",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Campi non validi: {name}",
"globals.messages.invalidID": "ID non valido",
"globals.messages.invalidUUID": "UUID non valido",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Valore/i mancante/i: {name}",
"globals.messages.notFound": "{name} introvabile",
"globals.messages.numSelected": "{num} selezionati",
@@ -634,6 +637,7 @@
"users.firstTime": "Questa è una installazione nuova. Scegliere un nome utente e una password per l'account Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Login o password non validi",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Richiesta di autorizzazione non valida",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Ultimo login",
@@ -662,6 +666,15 @@
"users.roles": "Ruoli",
"users.status.disabled": "Disabilitato",
"users.status.enabled": "Abilitato",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipo",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/jp.json b/i18n/jp.json
index b0c83997..620a24b1 100644
--- a/i18n/jp.json
+++ b/i18n/jp.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "コピー",
"globals.buttons.delete": "消去",
"globals.buttons.deleteAll": "全て消去",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "編集",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "有効",
"globals.buttons.insert": "入れる",
"globals.buttons.learnMore": "さらに詳しく",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "無効なフィールド:{name}",
"globals.messages.invalidID": "無効なID",
"globals.messages.invalidUUID": "無効なUUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "フィールドがありません: {name}",
"globals.messages.notFound": "{name} が見つかりません。",
"globals.messages.numSelected": "{num} 選択済み",
@@ -634,6 +637,7 @@
"users.firstTime": "これは新しいインストールです。スーパーアドミンアカウントのユーザー名とパスワードを選択してください。",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "ログインまたはパスワードが無効です",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "無効な認証リクエストです",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "最終ログイン",
@@ -662,6 +666,15 @@
"users.roles": "ロール",
"users.status.disabled": "無効",
"users.status.enabled": "有効",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "タイプ",
"users.type.api": "API",
"users.type.super": "スーパーアドミン",
diff --git a/i18n/ko.json b/i18n/ko.json
index f61b2fc7..b6fb70b7 100644
--- a/i18n/ko.json
+++ b/i18n/ko.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "복사",
"globals.buttons.delete": "삭제",
"globals.buttons.deleteAll": "전체 삭제",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "편집",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "활성화",
"globals.buttons.insert": "삽입",
"globals.buttons.learnMore": "자세히 보기",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "잘못된 필드: {name}",
"globals.messages.invalidID": "잘못된 ID",
"globals.messages.invalidUUID": "잘못된 UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "누락된 필드: {name}",
"globals.messages.notFound": "{name}을(를) 찾을 수 없습니다",
"globals.messages.numSelected": "{num} 선택됨",
@@ -634,6 +637,7 @@
"users.firstTime": "최초 설치입니다. 슈퍼 관리자 계정의 사용자명과 비밀번호를 설정하세요.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "잘못된 로그인 또는 비밀번호",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "잘못된 인증 요청",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "마지막 로그인",
@@ -662,6 +666,15 @@
"users.roles": "역할",
"users.status.disabled": "비활성화됨",
"users.status.enabled": "활성화됨",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "유형",
"users.type.api": "API",
"users.type.super": "슈퍼 관리자",
diff --git a/i18n/ml.json b/i18n/ml.json
index 84f7b53e..9f156d82 100644
--- a/i18n/ml.json
+++ b/i18n/ml.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "പകർത്തുക",
"globals.buttons.delete": "നീക്കം ചെയ്യുക",
"globals.buttons.deleteAll": "എല്ലാം നീക്കം ചെയ്യുക",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "തിരുത്തുക",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "പ്രവർത്തനക്ഷമാക്കി",
"globals.buttons.insert": "ഉൾച്ചേർക്കുക",
"globals.buttons.learnMore": "കൂടുതൽ അറിയുക",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "തെറ്റായ ഫീല്‍ഡുകള്‍: {name}",
"globals.messages.invalidID": "ഐഡി അസാധുവാണ്",
"globals.messages.invalidUUID": "യുയുഐഡി അസാധുവാണ്",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "വിട്ടുപോയ ഫീൽഡ്(കൾ): {name}",
"globals.messages.notFound": "{name} കണ്ടെത്തിയില്ല",
"globals.messages.numSelected": "{num} തിരഞ്ഞെടുക്കപ്പെട്ടത്",
@@ -634,6 +637,7 @@
"users.firstTime": "ഇത് പുതിയതായി ഇൻസ്റ്റാള്‍ ചെയ്ത ആകൗശലം അകൗണെഡ്ജ് ഉപയോക്താവായിരിക്കുന്നു. സൂപ്പർ അഡ്മിൻ അക്കൗണ്ടിന് ഉപയോഗിക്കുകയും പാസ്‌വേഡ് തിരഞ്ഞെടുക്കുകയും ചെയ്യുക.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "അസാധുവായ ലോഗിന്‍ അല്ലെങ്കിൽ പാസ്‌വേഡ്",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "അസാധുവായ പ്രവൃത്തിയുള്ള അനുമതിയുണ്ട്",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "അവസാന ലോഗിന്‍",
@@ -662,6 +666,15 @@
"users.roles": "പങ്കുകള്‍",
"users.status.disabled": "അപ്രാപ്തമാക്കി",
"users.status.enabled": "സജീവമാക്കി",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "തരം",
"users.type.api": "എപിഐ",
"users.type.super": "സൂപ്പർ അഡ്മിൻ",
diff --git a/i18n/nl.json b/i18n/nl.json
index 8e99abcb..d1330f8f 100644
--- a/i18n/nl.json
+++ b/i18n/nl.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopiëren",
"globals.buttons.delete": "Verwijder",
"globals.buttons.deleteAll": "Verwijder alles",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Bewerken",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Ingeschakeld",
"globals.buttons.insert": "Invoegen",
"globals.buttons.learnMore": "Meer leren",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Ongeldige velden: {name}",
"globals.messages.invalidID": "Ongeldige ID(s)",
"globals.messages.invalidUUID": "Ongeldige UUID(s)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Ontbrekend(e) veld(en): {name}",
"globals.messages.notFound": "{name} niet gevonden",
"globals.messages.numSelected": "{num} geselecteerd",
@@ -634,6 +637,7 @@
"users.firstTime": "Dit is een nieuwe installatie. Kies een gebruikersnaam en wachtwoord voor het Super Admin-account.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Ongeldige inloggegevens",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Ongeldig verzoek voor verificatie",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Laatste login",
@@ -662,6 +666,15 @@
"users.roles": "Rollen",
"users.status.disabled": "Uitgeschakeld",
"users.status.enabled": "Ingeschakeld",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Type",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/no.json b/i18n/no.json
index d2f0f8fd..deb6583b 100644
--- a/i18n/no.json
+++ b/i18n/no.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopier",
"globals.buttons.delete": "Slett",
"globals.buttons.deleteAll": "Slett alt",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Rediger",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Aktivert",
"globals.buttons.insert": "Sett inn",
"globals.buttons.learnMore": "Lær mer",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Ugyldige felt: {name}",
"globals.messages.invalidID": "Ugyldig(e) ID-er",
"globals.messages.invalidUUID": "Ugyldig(e) UUID-er",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Mangler felt(er): {name}",
"globals.messages.notFound": "{name} ikke funnet",
"globals.messages.numSelected": "{num} valgt",
@@ -634,6 +637,7 @@
"users.firstTime": "Dette er en fersk installasjon. Velg et brukernavn og passord for Super Admin-kontoen.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Ugyldig innlogging eller passord",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Ugyldig autentiseringsforespørsel",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Siste innlogging",
@@ -662,6 +666,15 @@
"users.roles": "Roller",
"users.status.disabled": "Deaktivert",
"users.status.enabled": "Aktivert",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Type",
"users.type.api": "API",
"users.type.super": "Superadmin",
diff --git a/i18n/pl.json b/i18n/pl.json
index 95145886..b156352a 100644
--- a/i18n/pl.json
+++ b/i18n/pl.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopiuj",
"globals.buttons.delete": "Usuń",
"globals.buttons.deleteAll": "Usuń wszystkie",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Edytuj",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Włączone",
"globals.buttons.insert": "Wstaw",
"globals.buttons.learnMore": "Dowiedz się więcej",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Nieprawidłowe pola: {name}",
"globals.messages.invalidID": "Nieprawidłowy ID",
"globals.messages.invalidUUID": "Nieprawidłowy UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Brakujące pole(a): {name}",
"globals.messages.notFound": "{name} nie znaleziono",
"globals.messages.numSelected": "{num} wybrano",
@@ -634,6 +637,7 @@
"users.firstTime": "To jest nowa instalacja. Wybierz nazwę użytkownika i hasło dla konta Super Admina.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Nieprawidłowe dane logowania lub hasło",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Nieprawidłowe żądanie uwierzytelniania",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Ostatnie logowanie",
@@ -662,6 +666,15 @@
"users.roles": "Role",
"users.status.disabled": "Wyłączone",
"users.status.enabled": "Włączone",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Typ",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index 7fd034aa..320b1ce0 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiar",
"globals.buttons.delete": "Excluir",
"globals.buttons.deleteAll": "Apagar tudo",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Editar",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Habilitado",
"globals.buttons.insert": "Inserir",
"globals.buttons.learnMore": "Saiba mais",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Campos inválidos: {name}",
"globals.messages.invalidID": "ID inválido",
"globals.messages.invalidUUID": "UUID inválido",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Campos ausente(s): {name}",
"globals.messages.notFound": "{name} não encontrado",
"globals.messages.numSelected": "{num} selecionado(s)",
@@ -634,6 +637,7 @@
"users.firstTime": "Esta é uma instalação nova. Escolha um nome de usuário e uma senha para a conta de Super Administrador.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Nome de usuário ou senha inválidos",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Requisição de autenticação inválida",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Último login",
@@ -662,6 +666,15 @@
"users.roles": "Papéis",
"users.status.disabled": "Desabilitado",
"users.status.enabled": "Habilitado",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipo",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/pt.json b/i18n/pt.json
index ff7e8249..e9a1cd65 100644
--- a/i18n/pt.json
+++ b/i18n/pt.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiar",
"globals.buttons.delete": "Eliminar",
"globals.buttons.deleteAll": "Eliminar todos",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Editar",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Ativo",
"globals.buttons.insert": "Inserir",
"globals.buttons.learnMore": "Saber mais",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Campos inválidos: {name}",
"globals.messages.invalidID": "ID inválido",
"globals.messages.invalidUUID": "UUID inválido",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Campo(s) em falta: {name}",
"globals.messages.notFound": "{name} não encontrado",
"globals.messages.numSelected": "{num} selecionado(s)",
@@ -634,6 +637,7 @@
"users.firstTime": "Esta é uma nova instalação. Escolha um nome de usuário e senha para a conta de Super Administrador.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Login ou senha inválidos",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Requisição de autenticação inválida",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Último login",
@@ -662,6 +666,15 @@
"users.roles": "Funções",
"users.status.disabled": "Desabilitado",
"users.status.enabled": "Habilitado",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tipo",
"users.type.api": "API",
"users.type.super": "Super Administrador",
diff --git a/i18n/ro.json b/i18n/ro.json
index 58adcecb..a6e65974 100644
--- a/i18n/ro.json
+++ b/i18n/ro.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Copiază",
"globals.buttons.delete": "Şterge",
"globals.buttons.deleteAll": "Șterge tot",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Editare",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Activat",
"globals.buttons.insert": "Introduceți",
"globals.buttons.learnMore": "Află mai mult",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Câmpuri nevalide: {name}",
"globals.messages.invalidID": "ID de hub nevalid",
"globals.messages.invalidUUID": "UUID nevalid",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Câmp(e) lipsă: {name}",
"globals.messages.notFound": "{name} nu a fost găsit",
"globals.messages.numSelected": "{num} selectate",
@@ -634,6 +637,7 @@
"users.firstTime": "Aceasta este o instalare nouă. Alegeți un nume de utilizator și o parolă pentru contul Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Autentificare sau parolă incorectă",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Cerere de autentificare nevalidă",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Ultima autentificare",
@@ -662,6 +666,15 @@
"users.roles": "Roluri",
"users.status.disabled": "Dezactivat",
"users.status.enabled": "Activat",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tip",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/ru.json b/i18n/ru.json
index c5abd2cb..5e781066 100644
--- a/i18n/ru.json
+++ b/i18n/ru.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Копировать",
"globals.buttons.delete": "Удалить",
"globals.buttons.deleteAll": "Удалить всё",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Редактировать",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Включено",
"globals.buttons.insert": "Вставить",
"globals.buttons.learnMore": "Подробнее",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Некорректные поля: {name}",
"globals.messages.invalidID": "Неверный ID",
"globals.messages.invalidUUID": "Неверный UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Отсутствует поле (поля): {name}",
"globals.messages.notFound": "{name} не найдено",
"globals.messages.numSelected": "{num} выбрано",
@@ -634,6 +637,7 @@
"users.firstTime": "Это новая установка. Выберите имя пользователя и пароль для учётной записи Супер Админа.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Неверный логин или пароль",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Неверный запрос аутентификации",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Последний вход",
@@ -662,6 +666,15 @@
"users.roles": "Роли",
"users.status.disabled": "Отключён",
"users.status.enabled": "Включён",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Тип",
"users.type.api": "API",
"users.type.super": "Супер Админ",
diff --git a/i18n/se.json b/i18n/se.json
index 644f3110..295b8970 100644
--- a/i18n/se.json
+++ b/i18n/se.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopiera",
"globals.buttons.delete": "Ta bort",
"globals.buttons.deleteAll": "Ta bort allt",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Redigera",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Aktiverat",
"globals.buttons.insert": "Infoga",
"globals.buttons.learnMore": "Läs mer",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Ogiltiga fält: {name}",
"globals.messages.invalidID": "Ogiltigt ID/ID:er",
"globals.messages.invalidUUID": "Ogiltigt UUID/UUID:n",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Saknade fält: {name}",
"globals.messages.notFound": "{name} hittades inte",
"globals.messages.numSelected": "{num} valda",
@@ -634,6 +637,7 @@
"users.firstTime": "Det här är en nyinstallation. Välj ett användarnamn och lösenord för användarkontot för superadmin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Ogiltig inloggning eller lösenord",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Ogiltig autentiseringförfrågan",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Senast inloggad",
@@ -662,6 +666,15 @@
"users.roles": "Roller",
"users.status.disabled": "Avaktiverad",
"users.status.enabled": "Aktiverad",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Typ",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/sk.json b/i18n/sk.json
index 5e78884c..821c9f7c 100644
--- a/i18n/sk.json
+++ b/i18n/sk.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopírovať",
"globals.buttons.delete": "Odstrániť",
"globals.buttons.deleteAll": "Odstrániť všetko",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Upraviť",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Povolené",
"globals.buttons.insert": "Vložiť",
"globals.buttons.learnMore": "Dalšie informácie",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Neplatné polia: {name}",
"globals.messages.invalidID": "Neplatné ID",
"globals.messages.invalidUUID": "Neplatné UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Chýbajúce pole: {name}",
"globals.messages.notFound": "{name} sa nenašlo",
"globals.messages.numSelected": "{num} vybraných",
@@ -634,6 +637,7 @@
"users.firstTime": "Je to čerstvá inštalácia. Vyberte si používateľské meno a heslo pre účet Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Neplatné prihlásenie alebo heslo",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Neplatná autentifikačná žiadosť",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Posledné prihlásenie",
@@ -662,6 +666,15 @@
"users.roles": "Role",
"users.status.disabled": "Zablokovaný",
"users.status.enabled": "Aktívny",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Typ",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/sl.json b/i18n/sl.json
index 36549908..72a4ed52 100644
--- a/i18n/sl.json
+++ b/i18n/sl.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopiraj",
"globals.buttons.delete": "Izbriši",
"globals.buttons.deleteAll": "Izbriši vse",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Uredi",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Omogočeno",
"globals.buttons.insert": "Vstavi",
"globals.buttons.learnMore": "Več o tem",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Neveljavna polja: {name}",
"globals.messages.invalidID": "Neveljavni ID(-ji)",
"globals.messages.invalidUUID": "Neveljavni UUID(-ji)",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Manjkajoče polje(a): {name}",
"globals.messages.notFound": "{name} ni bilo mogoče najti",
"globals.messages.numSelected": "{num} izbranih",
@@ -634,6 +637,7 @@
"users.firstTime": "To je sveža namestitev. Izberite uporabniško ime in geslo za super upravni račun.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Neveljavna prijava ali geslo",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Neveljavna zahteva za preverjanje pristnosti",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Zadnja prijava",
@@ -662,6 +666,15 @@
"users.roles": "Vloge",
"users.status.disabled": "Onemogočeno",
"users.status.enabled": "Omogočeno",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Vrsta",
"users.type.api": "API",
"users.type.super": "Super upravljalec",
diff --git a/i18n/tr.json b/i18n/tr.json
index 22968b2c..0f3ac123 100644
--- a/i18n/tr.json
+++ b/i18n/tr.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Kopyala",
"globals.buttons.delete": "Sil",
"globals.buttons.deleteAll": "Tamamını sil",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Değiştir",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Etkinleştirildi",
"globals.buttons.insert": "Ekle",
"globals.buttons.learnMore": "Daha fazla öğren",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Geçersiz alanlar: {name}",
"globals.messages.invalidID": "Yanlış ID",
"globals.messages.invalidUUID": "Yanlış UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Eksik alan(lar): {name}",
"globals.messages.notFound": "{name} bulunamadı",
"globals.messages.numSelected": "{num} seçildi",
@@ -634,6 +637,7 @@
"users.firstTime": "Bu yeni bir yüklemeler. Süper Yönetici hesabı için bir kullanıcı adı ve şifre seçin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Geçersiz giriş veya şifre",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Geçersiz kimlik doğrulama isteği",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Son giriş",
@@ -662,6 +666,15 @@
"users.roles": "Roller",
"users.status.disabled": "Devre Dışı",
"users.status.enabled": "Etkin",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Tür",
"users.type.api": "API",
"users.type.super": "Süper Yönetici",
diff --git a/i18n/uk.json b/i18n/uk.json
index 2a6b8118..d5dcd74a 100644
--- a/i18n/uk.json
+++ b/i18n/uk.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Копіювати",
"globals.buttons.delete": "Видалити",
"globals.buttons.deleteAll": "Видалити все",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Редагувати",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Увімкнено",
"globals.buttons.insert": "Вставити",
"globals.buttons.learnMore": "Дізнатися більше",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Хибні поля: {name}",
"globals.messages.invalidID": "Хибні ідентифікатори",
"globals.messages.invalidUUID": "Хибні UUID-коди",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Бракує полів: {name}",
"globals.messages.notFound": "{name} не знайдено",
"globals.messages.numSelected": "{num} вибрано",
@@ -634,6 +637,7 @@
"users.firstTime": "Це свіжа установка. Виберіть ім'я користувача та пароль для облікового запису Супер адміністратора.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Недійсний логін або пароль",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Недійсний запит авторизації",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Останній вхід",
@@ -662,6 +666,15 @@
"users.roles": "Ролі",
"users.status.disabled": "Вимкнено",
"users.status.enabled": "Увімкнено",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Тип",
"users.type.api": "API",
"users.type.super": "Супер Адміністратор",
diff --git a/i18n/vi.json b/i18n/vi.json
index 47ed97cd..8b108d13 100644
--- a/i18n/vi.json
+++ b/i18n/vi.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "Sao chép",
"globals.buttons.delete": "Xóa",
"globals.buttons.deleteAll": "Xóa hết",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "Sửa",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "Đã bật",
"globals.buttons.insert": "Chèn",
"globals.buttons.learnMore": "Tìm hiểu thêm",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "Trường không hợp lệ: {name}",
"globals.messages.invalidID": "ID(s) không hợp lệ",
"globals.messages.invalidUUID": " UUID(s) không hợp lệ",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "Lỗi trường: {name}",
"globals.messages.notFound": "{name} không tìm thấy",
"globals.messages.numSelected": "{num} đã chọn",
@@ -634,6 +637,7 @@
"users.firstTime": "Đây là lần cài đặt đầu tiên. Chọn tên người dùng và mật khẩu cho tài khoản Super Admin.",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "Đăng nhập hoặc mật khẩu không hợp lệ",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "Yêu cầu xác thực không hợp lệ",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "Lần đăng nhập gần nhất",
@@ -662,6 +666,15 @@
"users.roles": "Vai trò",
"users.status.disabled": "Vô hiệu hóa",
"users.status.enabled": "Đã kích hoạt",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "Loại",
"users.type.api": "API",
"users.type.super": "Super Admin",
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index be86cc55..a9e05999 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "复制",
"globals.buttons.delete": "删除",
"globals.buttons.deleteAll": "删除所有",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "编辑",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "启用",
"globals.buttons.insert": "添加",
"globals.buttons.learnMore": "更多",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "无效字段:{name}",
"globals.messages.invalidID": "ID 无效",
"globals.messages.invalidUUID": "无效的 UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "缺少字段:{name}",
"globals.messages.notFound": "{name} 未找到",
"globals.messages.numSelected": "已选择 {num}",
@@ -634,6 +637,7 @@
"users.firstTime": "这是一次全新安装。为超级管理员帐户选择用户名和密码。",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "无效的登录或密码",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "无效的身份验证请求",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "上次登录",
@@ -662,6 +666,15 @@
"users.roles": "角色",
"users.status.disabled": "已禁用",
"users.status.enabled": "已启用",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "类型",
"users.type.api": "API",
"users.type.super": "超级管理员",
diff --git a/i18n/zh-TW.json b/i18n/zh-TW.json
index 72c84a28..5ef84094 100644
--- a/i18n/zh-TW.json
+++ b/i18n/zh-TW.json
@@ -148,7 +148,9 @@
"globals.buttons.copy": "複製",
"globals.buttons.delete": "刪除",
"globals.buttons.deleteAll": "刪除所有",
+ "globals.buttons.disable": "Disable",
"globals.buttons.edit": "編輯",
+ "globals.buttons.enable": "Enable",
"globals.buttons.enabled": "啟用",
"globals.buttons.insert": "插入",
"globals.buttons.learnMore": "更多",
@@ -196,6 +198,7 @@
"globals.messages.invalidFields": "無效的欄位: {name}",
"globals.messages.invalidID": "ID 無效",
"globals.messages.invalidUUID": "無效的 UUID",
+ "globals.messages.invalidValue": "Invalid value",
"globals.messages.missingFields": "缺少欄位:{name}",
"globals.messages.notFound": "{name} 未找到",
"globals.messages.numSelected": "已選擇 {num}",
@@ -634,6 +637,7 @@
"users.firstTime": "這是全新的安裝。為超級管理員帳戶選擇使用者名稱和密碼。",
"users.forgotPassword": "Forgot password?",
"users.invalidLogin": "登入或密碼無效",
+ "users.invalidPassword": "Invalid password",
"users.invalidRequest": "無效的身份驗證請求",
"users.invalidResetLink": "Invalid or expired reset link",
"users.lastLogin": "上次登入",
@@ -662,6 +666,15 @@
"users.roles": "用戶角色",
"users.status.disabled": "已停用",
"users.status.enabled": "已啟用",
+ "users.totpCode": "TOTP code",
+ "users.totpCodeHelp": "Enter the 6-digit code from your authenticator app",
+ "users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.",
+ "users.totpSecret": "Secret key",
+ "users.twoFA": "Two-factor authentication",
+ "users.twoFAAlreadyEnabled": "Two-factor authentication is already enabled.",
+ "users.twoFAEnabled": "Two-factor authentication is on",
+ "users.twoFAEnabledDesc": "Your account is protected with {type} 2FA",
+ "users.twoFANotEnabled": "Enable 2FA for additional security when logging into your account.",
"users.type": "用戶類型",
"users.type.api": "API 用戶",
"users.type.super": "超級管理員",
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index d4978189..2ae26b38 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -84,7 +84,6 @@ func New(cfg Config, db *sql.DB, cb *Callbacks, lo *log.Logger) (*Auth, error) {
apiUsers: map[string]User{},
}
-
// Initialize session manager.
a.sess = simplesessions.New(simplesessions.Options{
EnableAutoCreate: false,
diff --git a/internal/auth/models.go b/internal/auth/models.go
index a516a84b..a864a52f 100644
--- a/internal/auth/models.go
+++ b/internal/auth/models.go
@@ -95,6 +95,8 @@ type User struct {
Type string `db:"type" json:"type"`
Status string `db:"status" json:"status"`
Avatar null.String `db:"avatar" json:"avatar"`
+ TwofaType string `db:"twofa_type" json:"twofa_type"`
+ TwofaKey null.String `db:"twofa_key" json:"-"`
LoggedInAt null.Time `db:"loggedin_at" json:"loggedin_at"`
UserRoleID int `db:"user_role_id" json:"user_role_id,omitempty"`
UserRoleName string `db:"user_role_name" json:"-"`
diff --git a/internal/core/users.go b/internal/core/users.go
index 8bdefae7..09dce492 100644
--- a/internal/core/users.go
+++ b/internal/core/users.go
@@ -122,6 +122,16 @@ func (c *Core) UpdateUserLogin(id int, avatar string) error {
return nil
}
+// SetTwoFA sets or clears the 2FA configuration for a user.
+func (c *Core) SetTwoFA(id int, twofaType, twofaKey string) error {
+ if _, err := c.q.SetUserTwoFA.Exec(id, twofaType, twofaKey); err != nil {
+ return echo.NewHTTPError(http.StatusInternalServerError,
+ c.i18n.Ts("globals.messages.errorUpdating", "name", "{globals.terms.user}", "error", pqErrMsg(err)))
+ }
+
+ return nil
+}
+
// DeleteUsers deletes a given user.
func (c *Core) DeleteUsers(ids []int) error {
res, err := c.q.DeleteUsers.Exec(pq.Array(ids))
diff --git a/internal/migrations/v5.2.0.go b/internal/migrations/v5.2.0.go
index f9b558b6..02e733ad 100644
--- a/internal/migrations/v5.2.0.go
+++ b/internal/migrations/v5.2.0.go
@@ -16,5 +16,21 @@ func V5_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf, lo *log.Logger
return err
}
+ // Add 2FA fields to users table.
+ _, err = db.Exec(`
+ DO $$ BEGIN
+ -- Create twofa_type enum if it doesn't exist
+ IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'twofa_type') THEN
+ CREATE TYPE twofa_type AS ENUM ('none', 'totp');
+ END IF;
+ END $$;
+
+ ALTER TABLE users ADD COLUMN IF NOT EXISTS twofa_type twofa_type NOT NULL DEFAULT 'none';
+ ALTER TABLE users ADD COLUMN IF NOT EXISTS twofa_key TEXT NULL;
+ `)
+ if err != nil {
+ return err
+ }
+
return nil
}
diff --git a/internal/tmptokens/tmptokens.go b/internal/tmptokens/tmptokens.go
new file mode 100644
index 00000000..8bc68e2c
--- /dev/null
+++ b/internal/tmptokens/tmptokens.go
@@ -0,0 +1,135 @@
+// Package tmptokens provides a simple in memory store for one time temp tokens with TTL.
+// This can be used for creating throwaway tokens for flows like password reset, 2FA verification, etc.
+// Tokens are automatically deleted when retrieved or when they expire.
+package tmptokens
+
+import (
+ "errors"
+ "sync"
+ "time"
+)
+
+const (
+ // maxTries is the maximum number of verification attempts allowed for a token.
+ // After this many failed checks, the token is automatically deleted.
+ maxTries = 15
+)
+
+// Token represents a temporary token with TTL and arbitrary data.
+type Token struct {
+ TTL time.Duration
+ CreatedAt time.Time
+ Count int
+ Data any
+}
+
+var (
+ Err = errors.New("token was not found or has expired")
+
+ tokens = make(map[string]Token)
+ mu sync.RWMutex
+)
+
+func init() {
+ // Start periodic cleanup of expired temporary tokens (2FA, password reset).
+ go func() {
+ ticker := time.NewTicker(time.Hour)
+ defer ticker.Stop()
+ for range ticker.C {
+ Clean()
+ }
+ }()
+}
+
+// Set stores a token with the given ID, TTL, and data.
+// If a token with the same ID already exists, it will be overwritten silently.
+func Set(id string, ttl time.Duration, data any) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ tokens[id] = Token{
+ TTL: ttl,
+ Data: data,
+ CreatedAt: time.Now(),
+ }
+}
+
+// Check retrieves a token by ID without deleting it.
+// An error is returned if the token doesn't exist or has expired.
+// Unlike Get(), this method does not consume/delete the token.
+// It also increments the check counter and deletes the token if maxTries is exceeded,
+// acting as a rate limiter.
+func Check(id string) (any, error) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ token, exists := tokens[id]
+ if !exists {
+ return nil, Err
+ }
+
+ // Check if token has expired.
+ if time.Since(token.CreatedAt) > token.TTL {
+ delete(tokens, id)
+ return nil, Err
+ }
+
+ // Increment the rate limit counter.
+ token.Count++
+
+ // Check if max attempts exceeded.
+ if token.Count > maxTries {
+ delete(tokens, id)
+ return nil, Err
+ }
+
+ // Update the token with the new count.
+ tokens[id] = token
+
+ return token.Data, nil
+}
+
+// Get retrieves a token by ID and automatically deletes it (after one time use).
+// An error is returned if the token doesn't exist or has expired.
+func Get(id string) (any, error) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ token, exists := tokens[id]
+ if !exists {
+ return nil, Err
+ }
+
+ // Check if token has expired.
+ if time.Since(token.CreatedAt) > token.TTL {
+ delete(tokens, id)
+ return nil, Err
+ }
+
+ // Delete the token.
+ delete(tokens, id)
+
+ return token.Data, nil
+}
+
+// Delete deletes a token by ID.
+func Delete(id string) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ delete(tokens, id)
+}
+
+// Clean deletes all expired tokens. This can be called periodically
+// to purge unused and expired tokens.
+func Clean() {
+ mu.Lock()
+ defer mu.Unlock()
+
+ now := time.Now()
+ for id, token := range tokens {
+ if now.Sub(token.CreatedAt) > token.TTL {
+ delete(tokens, id)
+ }
+ }
+}
diff --git a/models/models.go b/models/models.go
index 88ffbae3..6cf91b7f 100644
--- a/models/models.go
+++ b/models/models.go
@@ -82,6 +82,10 @@ const (
TemplateTypeCampaign = "campaign"
TemplateTypeCampaignVisual = "campaign_visual"
TemplateTypeTx = "tx"
+
+ // TwoFA types.
+ TwofaTypeNone = "none"
+ TwofaTypeTOTP = "totp"
)
// Headers represents an array of string maps used to represent SMTP, HTTP headers etc.
diff --git a/models/queries.go b/models/queries.go
index 4b41adf7..4b98d8ee 100644
--- a/models/queries.go
+++ b/models/queries.go
@@ -118,6 +118,7 @@ type Queries struct {
UpdateUser *sqlx.Stmt `query:"update-user"`
UpdateUserProfile *sqlx.Stmt `query:"update-user-profile"`
UpdateUserLogin *sqlx.Stmt `query:"update-user-login"`
+ SetUserTwoFA *sqlx.Stmt `query:"set-user-twofa"`
DeleteUsers *sqlx.Stmt `query:"delete-users"`
GetUsers *sqlx.Stmt `query:"get-users"`
GetUser *sqlx.Stmt `query:"get-user"`
diff --git a/queries.sql b/queries.sql
index ead6a7b1..924c6469 100644
--- a/queries.sql
+++ b/queries.sql
@@ -1315,6 +1315,9 @@ UPDATE users SET name=$2, email=(CASE WHEN password_login THEN $3 ELSE email END
-- name: update-user-login
UPDATE users SET loggedin_at=NOW(), avatar=(CASE WHEN $2 != '' THEN $2 ELSE avatar END) WHERE id=$1;
+-- name: set-user-twofa
+UPDATE users SET twofa_type=$2::twofa_type, twofa_key=$3, updated_at=NOW() WHERE id=$1;
+
-- name: get-user-roles
WITH mainroles AS (
SELECT ur.* FROM roles ur WHERE type = 'user' AND ur.parent_id IS NULL AND
diff --git a/schema.sql b/schema.sql
index 2b2fe9b2..2e2f2405 100644
--- a/schema.sql
+++ b/schema.sql
@@ -10,6 +10,7 @@ DROP TYPE IF EXISTS template_type CASCADE; CREATE TYPE template_type AS ENUM ('c
DROP TYPE IF EXISTS user_type CASCADE; CREATE TYPE user_type AS ENUM ('user', 'api');
DROP TYPE IF EXISTS user_status CASCADE; CREATE TYPE user_status AS ENUM ('enabled', 'disabled');
DROP TYPE IF EXISTS role_type CASCADE; CREATE TYPE role_type AS ENUM ('user', 'list');
+DROP TYPE IF EXISTS twofa_type CASCADE; CREATE TYPE twofa_type AS ENUM ('none', 'totp');
CREATE EXTENSION IF NOT EXISTS pgcrypto;
@@ -335,6 +336,8 @@ CREATE TABLE users (
user_role_id INTEGER NOT NULL REFERENCES roles(id) ON DELETE RESTRICT,
list_role_id INTEGER NULL REFERENCES roles(id) ON DELETE CASCADE,
status user_status NOT NULL DEFAULT 'disabled',
+ twofa_type twofa_type NOT NULL DEFAULT 'none',
+ twofa_key TEXT NULL,
loggedin_at TIMESTAMP WITH TIME ZONE NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
diff --git a/static/public/static/style.css b/static/public/static/style.css
index b0a8d9cd..3f9d762f 100644
--- a/static/public/static/style.css
+++ b/static/public/static/style.css
@@ -199,6 +199,11 @@ input[disabled] {
max-width: 24px;
margin-right: 10px;
}
+ .login input[name=totp_code] {
+ font-size: 2em;
+ letter-spacing: 5px;
+ text-align: center;
+ }
#btn-back {
display: none;
diff --git a/static/public/templates/twofa.html b/static/public/templates/twofa.html
new file mode 100644
index 00000000..28dd3347
--- /dev/null
+++ b/static/public/templates/twofa.html
@@ -0,0 +1,25 @@
+{{ define "admin-twofa" }}
+{{ template "header" .}}
+
+<section class="login">
+ <h2>{{ .L.T "users.twoFA"}}</h2>
+ <p>{{ .L.T "users.totpCodeHelp" }}</p>
+
+ <form method="post" action="/admin/login/twofa" class="form">
+ <div>
+ <input type="hidden" name="token" value="{{ .Data.Token }}" />
+ <input type="hidden" name="next" value="{{ .Data.NextURI }}" />
+ <p>
+ <input id="totp_code" type="text" name="totp_code" autofocus required
+ pattern="[0-9]{6}" maxlength="6" placeholder="• • • • • •" aria-label="{{ .L.T "users.totpCode" }}" />
+ </p>
+
+ {{ if .Data.Error }}<p><span class="error">{{ .Data.Error }}</span></p>{{ end }}
+
+ <p class="submit"><button class="button" type="submit">{{ .L.T "globals.buttons.continue" }}</button></p>
+ </div>
+ </form>
+</section>
+
+{{ template "footer" .}}
+{{ end }}