From 4b68ccf678e8520eb7cd41d86473736a827157a0 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 6 Apr 2024 13:07:16 +0800 Subject: [PATCH] update text content --- cmd/database.go | 4 +- cmd/user_data.go | 6 +- cmd/webserver.go | 2 +- conf/ezbookkeeping.ini | 2 +- pkg/api/accounts.go | 10 +- pkg/api/authorizations.go | 12 +- pkg/api/twofactor_authorizations.go | 34 +-- pkg/cli/user_data.go | 10 +- pkg/errs/account.go | 10 +- pkg/errs/global.go | 2 +- pkg/errs/token.go | 4 +- pkg/errs/twofactor_authorization.go | 10 +- pkg/middlewares/authorization.go | 2 +- pkg/models/user.go | 4 +- pkg/services/accounts.go | 6 +- .../desktop/SwitchToMobileDialog.vue | 2 +- src/components/mobile/MapSheet.vue | 2 +- src/consts/account.js | 2 +- src/lib/services.js | 4 +- src/locales/en.js | 229 +++++++++--------- src/locales/zh_Hans.js | 229 +++++++++--------- src/stores/account.js | 8 +- src/stores/exchangeRates.js | 6 +- src/stores/index.js | 14 +- src/stores/overview.js | 4 +- src/stores/statistics.js | 6 +- src/stores/token.js | 4 +- src/stores/transaction.js | 14 +- src/stores/transactionCategory.js | 8 +- src/stores/transactionTag.js | 4 +- src/stores/twoFactorAuth.js | 22 +- src/stores/user.js | 20 +- src/views/desktop/ExchangeRatesPage.vue | 2 +- src/views/desktop/ForgetPasswordPage.vue | 6 +- src/views/desktop/LoginPage.vue | 8 +- src/views/desktop/ResetPasswordPage.vue | 14 +- src/views/desktop/SignupPage.vue | 28 +-- src/views/desktop/UnlockPage.vue | 20 +- src/views/desktop/VerifyEmailPage.vue | 8 +- src/views/desktop/accounts/ListPage.vue | 6 +- .../accounts/list/dialogs/EditDialog.vue | 26 +- .../app/settings/tabs/AppLockSettingTab.vue | 16 +- .../settings/tabs/AppStatisticsSettingTab.vue | 4 +- src/views/desktop/categories/ListPage.vue | 6 +- .../categories/list/dialogs/EditDialog.vue | 2 +- .../cards/MonthlyIncomeAndExpenseCard.vue | 2 +- .../desktop/statistics/TransactionPage.vue | 2 +- src/views/desktop/tags/ListPage.vue | 6 +- .../transactions/list/dialogs/EditDialog.vue | 16 +- .../settings/tabs/UserBasicSettingTab.vue | 20 +- .../tabs/UserDataManagementSettingTab.vue | 4 +- .../settings/tabs/UserSecuritySettingTab.vue | 14 +- .../tabs/UserTwoFactorAuthSettingTab.vue | 20 +- src/views/mobile/ApplicationLockPage.vue | 16 +- src/views/mobile/ExchangeRatesPage.vue | 2 +- src/views/mobile/LoginPage.vue | 18 +- src/views/mobile/SignupPage.vue | 22 +- src/views/mobile/UnlockPage.vue | 16 +- src/views/mobile/accounts/EditPage.vue | 28 +-- src/views/mobile/accounts/ListPage.vue | 6 +- src/views/mobile/categories/EditPage.vue | 2 +- src/views/mobile/categories/ListPage.vue | 6 +- src/views/mobile/statistics/SettingsPage.vue | 4 +- .../mobile/statistics/TransactionPage.vue | 4 +- src/views/mobile/tags/ListPage.vue | 6 +- src/views/mobile/transactions/EditPage.vue | 20 +- src/views/mobile/transactions/ListPage.vue | 2 +- src/views/mobile/users/DataManagementPage.vue | 2 +- src/views/mobile/users/TwoFactorAuthPage.vue | 10 +- src/views/mobile/users/UserProfilePage.vue | 30 +-- 70 files changed, 557 insertions(+), 563 deletions(-) diff --git a/cmd/database.go b/cmd/database.go index d198f865..6202b650 100644 --- a/cmd/database.go +++ b/cmd/database.go @@ -58,7 +58,7 @@ func updateAllDatabaseTablesStructure() error { return err } - log.BootInfof("[database.updateAllDatabaseTablesStructure] two factor table maintained successfully") + log.BootInfof("[database.updateAllDatabaseTablesStructure] two-factor table maintained successfully") err = datastore.Container.UserStore.SyncStructs(new(models.TwoFactorRecoveryCode)) @@ -66,7 +66,7 @@ func updateAllDatabaseTablesStructure() error { return err } - log.BootInfof("[database.updateAllDatabaseTablesStructure] two factor recovery code table maintained successfully") + log.BootInfof("[database.updateAllDatabaseTablesStructure] two-factor recovery code table maintained successfully") err = datastore.Container.TokenStore.SyncStructs(new(models.TokenRecord)) diff --git a/cmd/user_data.go b/cmd/user_data.go index 168b4815..bcb95861 100644 --- a/cmd/user_data.go +++ b/cmd/user_data.go @@ -475,11 +475,11 @@ func disableUser2FA(c *cli.Context) error { err = clis.UserData.DisableUserTwoFactorAuthorization(c, username) if err != nil { - log.BootErrorf("[user_data.disableUser2FA] error occurs when disabling user two factor authorization") + log.BootErrorf("[user_data.disableUser2FA] error occurs when disabling user two-factor authorization") return err } - log.BootInfof("[user_data.disableUser2FA] two factor authorization of user \"%s\" has been disabled", username) + log.BootInfof("[user_data.disableUser2FA] two-factor authorization of user \"%s\" has been disabled", username) return nil } @@ -570,7 +570,7 @@ func exportUserTransaction(c *cli.Context) error { } if filePath == "" { - log.BootErrorf("[user_data.exportUserTransaction] export file path is not specified") + log.BootErrorf("[user_data.exportUserTransaction] export file path is unspecified") return os.ErrNotExist } diff --git a/cmd/webserver.go b/cmd/webserver.go index ae68174f..e2e863d1 100644 --- a/cmd/webserver.go +++ b/cmd/webserver.go @@ -242,7 +242,7 @@ func startWebServer(c *cli.Context) error { apiV1Route.POST("/users/verify_email/resend.json", bindApi(api.Users.UserSendVerifyEmailByLoginedUserHandler)) } - // Two Factor Authorization + // Two-Factor Authorization if config.EnableTwoFactor { apiV1Route.GET("/users/2fa/status.json", bindApi(api.TwoFactorAuthorizations.TwoFactorStatusHandler)) apiV1Route.POST("/users/2fa/enable/request.json", bindApi(api.TwoFactorAuthorizations.TwoFactorEnableRequestHandler)) diff --git a/conf/ezbookkeeping.ini b/conf/ezbookkeeping.ini index 4b071fd0..06d9441a 100644 --- a/conf/ezbookkeeping.ini +++ b/conf/ezbookkeeping.ini @@ -103,7 +103,7 @@ server_id = 0 # Used for signing, you must change it to keep your user data safe before you first run ezBookkeeping secret_key = -# Set to true to enable two factor authorization +# Set to true to enable two-factor authorization enable_two_factor = true # Token expired seconds (0 - 4294967295), default is 2592000 (30 days) diff --git a/pkg/api/accounts.go b/pkg/api/accounts.go index 4b60bbbc..8f8adf67 100644 --- a/pkg/api/accounts.go +++ b/pkg/api/accounts.go @@ -145,7 +145,7 @@ func (a *AccountsApi) AccountCreateHandler(c *core.Context) (any, *errs.Error) { if accountCreateReq.Type == models.ACCOUNT_TYPE_SINGLE_ACCOUNT { if len(accountCreateReq.SubAccounts) > 0 { - log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] account cannot have any sub accounts") + log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] account cannot have any sub-accounts") return nil, errs.ErrAccountCannotHaveSubAccounts } @@ -155,7 +155,7 @@ func (a *AccountsApi) AccountCreateHandler(c *core.Context) (any, *errs.Error) { } } else if accountCreateReq.Type == models.ACCOUNT_TYPE_MULTI_SUB_ACCOUNTS { if len(accountCreateReq.SubAccounts) < 1 { - log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] account does not have any sub accounts") + log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] account does not have any sub-accounts") return nil, errs.ErrAccountHaveNoSubAccount } @@ -173,17 +173,17 @@ func (a *AccountsApi) AccountCreateHandler(c *core.Context) (any, *errs.Error) { subAccount := accountCreateReq.SubAccounts[i] if subAccount.Category != accountCreateReq.Category { - log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] category of sub account not equals to parent") + log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] category of sub-account not equals to parent") return nil, errs.ErrSubAccountCategoryNotEqualsToParent } if subAccount.Type != models.ACCOUNT_TYPE_SINGLE_ACCOUNT { - log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] sub account type invalid") + log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] sub-account type invalid") return nil, errs.ErrSubAccountTypeInvalid } if subAccount.Currency == validators.ParentAccountCurrencyPlaceholder { - log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] sub account cannot set currency placeholder") + log.WarnfWithRequestId(c, "[accounts.AccountCreateHandler] sub-account cannot set currency placeholder") return nil, errs.ErrAccountCurrencyInvalid } } diff --git a/pkg/api/authorizations.go b/pkg/api/authorizations.go index 94a8d99c..80ed5824 100644 --- a/pkg/api/authorizations.go +++ b/pkg/api/authorizations.go @@ -77,7 +77,7 @@ func (a *AuthorizationsApi) AuthorizeHandler(c *core.Context) (any, *errs.Error) twoFactorEnable, err = a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, user.Uid) if err != nil { - log.ErrorfWithRequestId(c, "[authorizations.AuthorizeHandler] failed to check two factor setting for user \"uid:%d\", because %s", user.Uid, err.Error()) + log.ErrorfWithRequestId(c, "[authorizations.AuthorizeHandler] failed to check two-factor setting for user \"uid:%d\", because %s", user.Uid, err.Error()) return nil, errs.Or(err, errs.ErrSystemError) } } @@ -122,7 +122,7 @@ func (a *AuthorizationsApi) TwoFactorAuthorizeHandler(c *core.Context) (any, *er twoFactorSetting, err := a.twoFactorAuthorizations.GetUserTwoFactorSettingByUid(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[authorizations.TwoFactorAuthorizeHandler] failed to get two factor setting for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[authorizations.TwoFactorAuthorizeHandler] failed to get two-factor setting for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrSystemError) } @@ -165,7 +165,7 @@ func (a *AuthorizationsApi) TwoFactorAuthorizeHandler(c *core.Context) (any, *er c.SetTextualToken(token) c.SetTokenClaims(claims) - log.InfofWithRequestId(c, "[authorizations.TwoFactorAuthorizeHandler] user \"uid:%d\" has authorized two factor via passcode, token will be expired at %d", user.Uid, claims.ExpiresAt) + log.InfofWithRequestId(c, "[authorizations.TwoFactorAuthorizeHandler] user \"uid:%d\" has authorized two-factor via passcode, token will be expired at %d", user.Uid, claims.ExpiresAt) authResp := a.getAuthResponse(token, false, user) return authResp, nil @@ -185,7 +185,7 @@ func (a *AuthorizationsApi) TwoFactorAuthorizeByRecoveryCodeHandler(c *core.Cont enableTwoFactor, err := a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, uid) if err != nil { - log.WarnfWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] failed to get two factor setting for user \"uid:%d\", because %s", uid, err.Error()) + log.WarnfWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] failed to get two-factor setting for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrSystemError) } @@ -213,7 +213,7 @@ func (a *AuthorizationsApi) TwoFactorAuthorizeByRecoveryCodeHandler(c *core.Cont err = a.twoFactorAuthorizations.GetAndUseUserTwoFactorRecoveryCode(c, uid, credential.RecoveryCode, user.Salt) if err != nil { - log.WarnfWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] failed to get two factor recovery code for user \"uid:%d\", because %s", uid, err.Error()) + log.WarnfWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] failed to get two-factor recovery code for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrTwoFactorRecoveryCodeNotExist) } @@ -234,7 +234,7 @@ func (a *AuthorizationsApi) TwoFactorAuthorizeByRecoveryCodeHandler(c *core.Cont c.SetTextualToken(token) c.SetTokenClaims(claims) - log.InfofWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] user \"uid:%d\" has authorized two factor via recovery code \"%s\", token will be expired at %d", user.Uid, credential.RecoveryCode, claims.ExpiresAt) + log.InfofWithRequestId(c, "[authorizations.TwoFactorAuthorizeByRecoveryCodeHandler] user \"uid:%d\" has authorized two-factor via recovery code \"%s\", token will be expired at %d", user.Uid, credential.RecoveryCode, claims.ExpiresAt) authResp := a.getAuthResponse(token, false, user) return authResp, nil diff --git a/pkg/api/twofactor_authorizations.go b/pkg/api/twofactor_authorizations.go index c85558f6..f5213ad6 100644 --- a/pkg/api/twofactor_authorizations.go +++ b/pkg/api/twofactor_authorizations.go @@ -45,7 +45,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorStatusHandler(c *core.Context) (an } if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorStatusHandler] failed to get two factor setting, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorStatusHandler] failed to get two-factor setting, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -63,7 +63,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorEnableRequestHandler(c *core.Conte enabled, err := a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to check two factor setting, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to check two-factor setting, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -84,14 +84,14 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorEnableRequestHandler(c *core.Conte key, err := a.twoFactorAuthorizations.GenerateTwoFactorSecret(c, user) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to generate two factor secret, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to generate two-factor secret, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } img, err := key.Image(240, 240) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to generate two factor qrcode, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableRequestHandler] failed to generate two-factor qrcode, because %s", err.Error()) return nil, errs.ErrOperationFailed } @@ -123,7 +123,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorEnableConfirmHandler(c *core.Conte exists, err := a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to check two factor setting, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to check two-factor setting, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -154,25 +154,25 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorEnableConfirmHandler(c *core.Conte recoveryCodes, err := a.twoFactorAuthorizations.GenerateTwoFactorRecoveryCodes() if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to generate two factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to generate two-factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } err = a.twoFactorAuthorizations.CreateTwoFactorRecoveryCodes(c, uid, recoveryCodes, user.Salt) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to create two factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to create two-factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } err = a.twoFactorAuthorizations.CreateTwoFactorSetting(c, twoFactorSetting) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to create two factor setting for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] failed to create two-factor setting for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } - log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] user \"uid:%d\" has enabled two factor authorization", uid) + log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorEnableConfirmHandler] user \"uid:%d\" has enabled two-factor authorization", uid) now := time.Now().Unix() err = a.tokens.DeleteTokensBeforeTime(c, uid, now) @@ -236,7 +236,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorDisableHandler(c *core.Context) (a enableTwoFactor, err := a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to check two factor setting, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to check two-factor setting, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -247,18 +247,18 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorDisableHandler(c *core.Context) (a err = a.twoFactorAuthorizations.DeleteTwoFactorRecoveryCodes(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to delete two factor recovery codes for user \"uid:%d\"", uid) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to delete two-factor recovery codes for user \"uid:%d\"", uid) return nil, errs.Or(err, errs.ErrOperationFailed) } err = a.twoFactorAuthorizations.DeleteTwoFactorSetting(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to delete two factor setting for user \"uid:%d\"", uid) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] failed to delete two-factor setting for user \"uid:%d\"", uid) return nil, errs.Or(err, errs.ErrOperationFailed) } - log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] user \"uid:%d\" has disabled two factor authorization", uid) + log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorDisableHandler] user \"uid:%d\" has disabled two-factor authorization", uid) return true, nil } @@ -291,7 +291,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorRecoveryCodeRegenerateHandler(c *c enableTwoFactor, err := a.twoFactorAuthorizations.ExistsTwoFactorSetting(c, uid) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to check two factor setting, because %s", err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to check two-factor setting, because %s", err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -302,14 +302,14 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorRecoveryCodeRegenerateHandler(c *c recoveryCodes, err := a.twoFactorAuthorizations.GenerateTwoFactorRecoveryCodes() if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to generate two factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to generate two-factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } err = a.twoFactorAuthorizations.CreateTwoFactorRecoveryCodes(c, uid, recoveryCodes, user.Salt) if err != nil { - log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to create two factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) + log.ErrorfWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] failed to create two-factor recovery codes for user \"uid:%d\", because %s", uid, err.Error()) return nil, errs.Or(err, errs.ErrOperationFailed) } @@ -317,7 +317,7 @@ func (a *TwoFactorAuthorizationsApi) TwoFactorRecoveryCodeRegenerateHandler(c *c RecoveryCodes: recoveryCodes, } - log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] user \"uid:%d\" has regenerated two factor recovery codes", uid) + log.InfofWithRequestId(c, "[twofactor_authorizations.TwoFactorRecoveryCodeRegenerateHandler] user \"uid:%d\" has regenerated two-factor recovery codes", uid) return recoveryCodesResp, nil } diff --git a/pkg/cli/user_data.go b/pkg/cli/user_data.go index 598d6d89..ae226769 100644 --- a/pkg/cli/user_data.go +++ b/pkg/cli/user_data.go @@ -393,7 +393,7 @@ func (l *UserDataCli) DisableUserTwoFactorAuthorization(c *cli.Context, username enableTwoFactor, err := l.twoFactorAuthorizations.ExistsTwoFactorSetting(nil, uid) if err != nil { - log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to check two factor setting, because %s", err.Error()) + log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to check two-factor setting, because %s", err.Error()) return err } @@ -404,14 +404,14 @@ func (l *UserDataCli) DisableUserTwoFactorAuthorization(c *cli.Context, username err = l.twoFactorAuthorizations.DeleteTwoFactorRecoveryCodes(nil, uid) if err != nil { - log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to delete two factor recovery codes for user \"%s\"", username) + log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to delete two-factor recovery codes for user \"%s\"", username) return err } err = l.twoFactorAuthorizations.DeleteTwoFactorSetting(nil, uid) if err != nil { - log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to delete two factor setting for user \"%s\"", username) + log.BootErrorf("[user_data.DisableUserTwoFactorAuthorization] failed to delete two-factor setting for user \"%s\"", username) return err } @@ -647,7 +647,7 @@ func (l *UserDataCli) checkTransactionAccount(c *cli.Context, transaction *model } if account.ParentAccountId == models.LevelOneAccountParentId && accountHasChild[account.AccountId] { - log.BootErrorf("[user_data.checkTransactionAccount] the account \"id:%d\" of transaction \"id:%d\" is not a sub account", transaction.AccountId, transaction.TransactionId) + log.BootErrorf("[user_data.checkTransactionAccount] the account \"id:%d\" of transaction \"id:%d\" is not a sub-account", transaction.AccountId, transaction.TransactionId) return errs.ErrOperationFailed } @@ -660,7 +660,7 @@ func (l *UserDataCli) checkTransactionAccount(c *cli.Context, transaction *model } if relatedAccount.ParentAccountId == models.LevelOneAccountParentId && accountHasChild[relatedAccount.AccountId] { - log.BootErrorf("[user_data.checkTransactionAccount] the related account \"id:%d\" of transaction \"id:%d\" is not a sub account", transaction.RelatedAccountId, transaction.TransactionId) + log.BootErrorf("[user_data.checkTransactionAccount] the related account \"id:%d\" of transaction \"id:%d\" is not a sub-account", transaction.RelatedAccountId, transaction.TransactionId) return errs.ErrOperationFailed } } diff --git a/pkg/errs/account.go b/pkg/errs/account.go index 98d4ac5d..c7fe7311 100644 --- a/pkg/errs/account.go +++ b/pkg/errs/account.go @@ -8,13 +8,13 @@ var ( ErrAccountNotFound = NewNormalError(NormalSubcategoryAccount, 1, http.StatusBadRequest, "account not found") ErrAccountTypeInvalid = NewNormalError(NormalSubcategoryAccount, 2, http.StatusBadRequest, "account type is invalid") ErrAccountCurrencyInvalid = NewNormalError(NormalSubcategoryAccount, 3, http.StatusBadRequest, "account currency is invalid") - ErrAccountHaveNoSubAccount = NewNormalError(NormalSubcategoryAccount, 4, http.StatusBadRequest, "account must have at least one sub account") - ErrAccountCannotHaveSubAccounts = NewNormalError(NormalSubcategoryAccount, 5, http.StatusBadRequest, "account cannot have sub accounts") + ErrAccountHaveNoSubAccount = NewNormalError(NormalSubcategoryAccount, 4, http.StatusBadRequest, "account must have at least one sub-account") + ErrAccountCannotHaveSubAccounts = NewNormalError(NormalSubcategoryAccount, 5, http.StatusBadRequest, "account cannot have sub-accounts") ErrParentAccountCannotSetCurrency = NewNormalError(NormalSubcategoryAccount, 6, http.StatusBadRequest, "parent account cannot set currency") ErrParentAccountCannotSetBalance = NewNormalError(NormalSubcategoryAccount, 7, http.StatusBadRequest, "parent account cannot set balance") - ErrSubAccountCategoryNotEqualsToParent = NewNormalError(NormalSubcategoryAccount, 8, http.StatusBadRequest, "sub account category not equals to parent") - ErrSubAccountTypeInvalid = NewNormalError(NormalSubcategoryAccount, 9, http.StatusBadRequest, "sub account type invalid") - ErrCannotAddOrDeleteSubAccountsWhenModify = NewNormalError(NormalSubcategoryAccount, 10, http.StatusBadRequest, "cannot add or delete sub accounts when modify account") + ErrSubAccountCategoryNotEqualsToParent = NewNormalError(NormalSubcategoryAccount, 8, http.StatusBadRequest, "sub-account category not equals to parent") + ErrSubAccountTypeInvalid = NewNormalError(NormalSubcategoryAccount, 9, http.StatusBadRequest, "sub-account type invalid") + ErrCannotAddOrDeleteSubAccountsWhenModify = NewNormalError(NormalSubcategoryAccount, 10, http.StatusBadRequest, "cannot add or delete sub-accounts when modify account") ErrSourceAccountNotFound = NewNormalError(NormalSubcategoryAccount, 11, http.StatusBadRequest, "source account not found") ErrDestinationAccountNotFound = NewNormalError(NormalSubcategoryAccount, 12, http.StatusBadRequest, "destination account not found") ErrAccountInUseCannotBeDeleted = NewNormalError(NormalSubcategoryAccount, 13, http.StatusBadRequest, "account is in use and cannot be deleted") diff --git a/pkg/errs/global.go b/pkg/errs/global.go index 1e6975c4..00ec3116 100644 --- a/pkg/errs/global.go +++ b/pkg/errs/global.go @@ -16,7 +16,7 @@ var ( ErrPageIndexInvalid = NewNormalError(NormalSubcategoryGlobal, 6, http.StatusBadRequest, "page index is invalid") ErrPageCountInvalid = NewNormalError(NormalSubcategoryGlobal, 7, http.StatusBadRequest, "page count is invalid") ErrClientTimezoneOffsetInvalid = NewNormalError(NormalSubcategoryGlobal, 8, http.StatusBadRequest, "client timezone offset is invalid") - ErrQueryItemsEmpty = NewNormalError(NormalSubcategoryGlobal, 9, http.StatusBadRequest, "query items cannot be empty") + ErrQueryItemsEmpty = NewNormalError(NormalSubcategoryGlobal, 9, http.StatusBadRequest, "query items cannot be blank") ErrQueryItemsTooMuch = NewNormalError(NormalSubcategoryGlobal, 10, http.StatusBadRequest, "query items too much") ErrQueryItemsInvalid = NewNormalError(NormalSubcategoryGlobal, 11, http.StatusBadRequest, "query items have invalid item") ErrParameterInvalid = NewNormalError(NormalSubcategoryGlobal, 12, http.StatusBadRequest, "parameter invalid") diff --git a/pkg/errs/token.go b/pkg/errs/token.go index 14c4a8de..af326421 100644 --- a/pkg/errs/token.go +++ b/pkg/errs/token.go @@ -11,8 +11,8 @@ var ( ErrCurrentInvalidToken = NewNormalError(NormalSubcategoryToken, 2, http.StatusUnauthorized, "current token is invalid") ErrCurrentTokenExpired = NewNormalError(NormalSubcategoryToken, 3, http.StatusUnauthorized, "current token is expired") ErrCurrentInvalidTokenType = NewNormalError(NormalSubcategoryToken, 4, http.StatusUnauthorized, "current token type is invalid") - ErrCurrentTokenRequire2FA = NewNormalError(NormalSubcategoryToken, 5, http.StatusUnauthorized, "current token requires two factor authorization") - ErrCurrentTokenNotRequire2FA = NewNormalError(NormalSubcategoryToken, 6, http.StatusUnauthorized, "current token does not require two factor authorization") + ErrCurrentTokenRequire2FA = NewNormalError(NormalSubcategoryToken, 5, http.StatusUnauthorized, "current token requires two-factor authorization") + ErrCurrentTokenNotRequire2FA = NewNormalError(NormalSubcategoryToken, 6, http.StatusUnauthorized, "current token does not require two-factor authorization") ErrInvalidToken = NewNormalError(NormalSubcategoryToken, 7, http.StatusBadRequest, "token is invalid") ErrInvalidTokenId = NewNormalError(NormalSubcategoryToken, 8, http.StatusBadRequest, "token id is invalid") ErrInvalidUserTokenId = NewNormalError(NormalSubcategoryToken, 9, http.StatusBadRequest, "user token id is invalid") diff --git a/pkg/errs/twofactor_authorization.go b/pkg/errs/twofactor_authorization.go index 0915d298..96646d80 100644 --- a/pkg/errs/twofactor_authorization.go +++ b/pkg/errs/twofactor_authorization.go @@ -2,11 +2,11 @@ package errs import "net/http" -// Error codes related to two factor authorization +// Error codes related to two-factor authorization var ( ErrPasscodeInvalid = NewNormalError(NormalSubcategoryTwofactor, 0, http.StatusUnauthorized, "passcode is invalid") - ErrTwoFactorRecoveryCodeInvalid = NewNormalError(NormalSubcategoryTwofactor, 1, http.StatusUnauthorized, "two factor backup code is invalid") - ErrTwoFactorRecoveryCodeNotExist = NewNormalError(NormalSubcategoryTwofactor, 2, http.StatusUnauthorized, "two factor backup code does not exist") - ErrTwoFactorIsNotEnabled = NewNormalError(NormalSubcategoryTwofactor, 3, http.StatusBadRequest, "two factor is not enabled") - ErrTwoFactorAlreadyEnabled = NewNormalError(NormalSubcategoryTwofactor, 4, http.StatusBadRequest, "two factor has already been enabled") + ErrTwoFactorRecoveryCodeInvalid = NewNormalError(NormalSubcategoryTwofactor, 1, http.StatusUnauthorized, "two-factor backup code is invalid") + ErrTwoFactorRecoveryCodeNotExist = NewNormalError(NormalSubcategoryTwofactor, 2, http.StatusUnauthorized, "two-factor backup code does not exist") + ErrTwoFactorIsNotEnabled = NewNormalError(NormalSubcategoryTwofactor, 3, http.StatusBadRequest, "two-factor is not enabled") + ErrTwoFactorAlreadyEnabled = NewNormalError(NormalSubcategoryTwofactor, 4, http.StatusBadRequest, "two-factor has already been enabled") ) diff --git a/pkg/middlewares/authorization.go b/pkg/middlewares/authorization.go index 7ddea3ce..1de9ae29 100644 --- a/pkg/middlewares/authorization.go +++ b/pkg/middlewares/authorization.go @@ -47,7 +47,7 @@ func JWTTwoFactorAuthorization(c *core.Context) { } if claims.Type != core.USER_TOKEN_TYPE_REQUIRE_2FA { - log.WarnfWithRequestId(c, "[authorization.JWTTwoFactorAuthorization] user \"uid:%d\" token is not need two factor authorization", claims.Uid) + log.WarnfWithRequestId(c, "[authorization.JWTTwoFactorAuthorization] user \"uid:%d\" token is not need two-factor authorization", claims.Uid) utils.PrintJsonErrorResult(c, errs.ErrCurrentTokenNotRequire2FA) return } diff --git a/pkg/models/user.go b/pkg/models/user.go index 43de5507..6582c936 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -11,7 +11,7 @@ import ( // TransactionEditScope represents the scope which transaction can be edited type TransactionEditScope byte -// Editable Transaction Scopes +// Editable Transaction Ranges const ( TRANSACTION_EDIT_SCOPE_NONE TransactionEditScope = 0 TRANSACTION_EDIT_SCOPE_ALL TransactionEditScope = 1 @@ -23,7 +23,7 @@ const ( TRANSACTION_EDIT_SCOPE_INVALID TransactionEditScope = 255 ) -// String returns a textual representation of the editable transaction scopes enum +// String returns a textual representation of the editable transaction ranges enum func (s TransactionEditScope) String() string { switch s { case TRANSACTION_EDIT_SCOPE_NONE: diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index 3a59dc23..08959fea 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -54,7 +54,7 @@ func (s *AccountService) GetAllAccountsByUid(c *core.Context, uid int64) ([]*mod return accounts, err } -// GetAccountAndSubAccountsByAccountId returns account model and sub account models according to account id +// GetAccountAndSubAccountsByAccountId returns account model and sub-account models according to account id func (s *AccountService) GetAccountAndSubAccountsByAccountId(c *core.Context, uid int64, accountId int64) ([]*models.Account, error) { if uid <= 0 { return nil, errs.ErrUserIdInvalid @@ -70,7 +70,7 @@ func (s *AccountService) GetAccountAndSubAccountsByAccountId(c *core.Context, ui return accounts, err } -// GetSubAccountsByAccountId returns sub account models according to account id +// GetSubAccountsByAccountId returns sub-account models according to account id func (s *AccountService) GetSubAccountsByAccountId(c *core.Context, uid int64, accountId int64) ([]*models.Account, error) { if uid <= 0 { return nil, errs.ErrUserIdInvalid @@ -127,7 +127,7 @@ func (s *AccountService) GetMaxDisplayOrder(c *core.Context, uid int64, category } } -// GetMaxSubAccountDisplayOrder returns the max display order of sub account according to account category and parent account id +// GetMaxSubAccountDisplayOrder returns the max display order of sub-account according to account category and parent account id func (s *AccountService) GetMaxSubAccountDisplayOrder(c *core.Context, uid int64, category models.AccountCategory, parentAccountId int64) (int32, error) { if uid <= 0 { return 0, errs.ErrUserIdInvalid diff --git a/src/components/desktop/SwitchToMobileDialog.vue b/src/components/desktop/SwitchToMobileDialog.vue index 1f53c827..8ec374d2 100644 --- a/src/components/desktop/SwitchToMobileDialog.vue +++ b/src/components/desktop/SwitchToMobileDialog.vue @@ -7,7 +7,7 @@ diff --git a/src/components/mobile/MapSheet.vue b/src/components/mobile/MapSheet.vue index e76b2250..7d85d2e9 100644 --- a/src/components/mobile/MapSheet.vue +++ b/src/components/mobile/MapSheet.vue @@ -19,7 +19,7 @@ - + diff --git a/src/views/mobile/LoginPage.vue b/src/views/mobile/LoginPage.vue index 3e9ece76..8d0bd535 100644 --- a/src/views/mobile/LoginPage.vue +++ b/src/views/mobile/LoginPage.vue @@ -142,7 +142,7 @@

- {{ $t('Please input your email address used for registration and we\'ll send you an email with reset password link') }} + {{ $t('Please enter your email address used for registration and we\'ll send you an email with a reset password link') }}

@@ -257,24 +257,24 @@ export default { }, inputEmptyProblemMessage() { if (!this.user.username) { - return 'Username cannot be empty'; + return 'Username cannot be blank'; } else if (!this.user.password) { - return 'Password cannot be empty'; + return 'Password cannot be blank'; } else if (!this.user.confirmPassword) { - return 'Confirmation password cannot be empty'; + return 'Password confirmation cannot be blank'; } else if (!this.user.email) { - return 'Email address cannot be empty'; + return 'Email address cannot be blank'; } else if (!this.user.nickname) { - return 'Nickname cannot be empty'; + return 'Nickname cannot be blank'; } else if (!this.user.defaultCurrency) { - return 'Default currency cannot be empty'; + return 'Default currency cannot be blank'; } else { return null; } }, inputInvalidProblemMessage() { if (this.user.password && this.user.confirmPassword && this.user.password !== this.user.confirmPassword) { - return 'Password and confirmation password do not match'; + return 'Password and password confirmation do not match'; } else { return null; } @@ -310,9 +310,9 @@ export default { self.$hideLoading(); if (self.usePresetCategories && !response.presetCategoriesSaved) { - self.$toast('You have been successfully registered, but something wrong with adding preset categories. You can re-add preset categories in settings page anytime.', 5000); + self.$toast('You have been successfully registered, but there was an failure when adding preset categories. You can re-add preset categories in settings page anytime.', 5000); } else if (response.needVerifyEmail) { - self.$toast('You have been successfully registered. Account activation link has been sent to your email address, please activate your account first.', 5000); + self.$toast('You have been successfully registered. An account activation link has been sent to your email address, please activate your account first.', 5000); } else { self.$toast('You have been successfully registered'); } @@ -334,7 +334,7 @@ export default { self.$hideLoading(); if (self.usePresetCategories && !response.presetCategoriesSaved) { - self.$toast('You have been successfully registered, but something wrong with adding preset categories. You can re-add preset categories in settings page anytime.'); + self.$toast('You have been successfully registered, but there was an failure when adding preset categories. You can re-add preset categories in settings page anytime.'); } else { self.$toast('You have been successfully registered'); } diff --git a/src/views/mobile/UnlockPage.vue b/src/views/mobile/UnlockPage.vue index 02cb4667..e8cf4e82 100644 --- a/src/views/mobile/UnlockPage.vue +++ b/src/views/mobile/UnlockPage.vue @@ -17,8 +17,8 @@ - - + + @@ -120,7 +120,7 @@ export default { } if (!webauthn.isSupported()) { - self.$toast('This device does not support WebAuthn'); + self.$toast('WebAuth is not supported on this device'); return; } @@ -150,11 +150,11 @@ export default { logger.error('failed to use webauthn to verify', error); if (error.notSupported) { - self.$toast('This device does not support WebAuthn'); + self.$toast('WebAuth is not supported on this device'); } else if (error.name === 'NotAllowedError') { self.$toast('User has canceled authentication'); } else if (error.invalid) { - self.$toast('Failed to authenticate by WebAuthn'); + self.$toast('Failed to authenticate with WebAuthn'); } else { self.$toast('User has canceled or this device does not support WebAuthn'); } @@ -175,7 +175,7 @@ export default { const user = self.userStore.currentUserInfo; if (!user || !user.username) { - self.$alert('An error has occurred'); + self.$alert('An error occurred'); return; } @@ -194,8 +194,8 @@ export default { router.refreshPage(); } catch (ex) { - logger.error('failed to unlock by pin code', ex); - self.$toast('PIN code is wrong'); + logger.error('failed to unlock with pin code', ex); + self.$toast('Incorrect PIN code'); } }, relogin() { diff --git a/src/views/mobile/accounts/EditPage.vue b/src/views/mobile/accounts/EditPage.vue index 304ed77d..e0a61bfc 100644 --- a/src/views/mobile/accounts/EditPage.vue +++ b/src/views/mobile/accounts/EditPage.vue @@ -282,7 +282,7 @@ {{ $t('Sub Account') + ' #' + (idx + 1) }} @@ -291,8 +291,8 @@ @@ -304,7 +304,7 @@
- {{ $t('Sub Account Icon') }} + {{ $t('Sub-account Icon') }}
@@ -326,7 +326,7 @@
- {{ $t('Sub Account Color') }} + {{ $t('Sub-account Color') }}
@@ -370,7 +370,7 @@ link="#" no-chevron class="list-item-with-header-and-title" :class="{ 'disabled': editAccountId }" - :header="$t('Sub Account Balance')" + :header="$t('Sub-account Balance')" :title="getAccountBalance(subAccount)" @click="subAccount.showBalanceSheet = true" > @@ -389,7 +389,7 @@ type="textarea" style="height: auto" :label="$t('Description')" - :placeholder="$t('Your sub account description (optional)')" + :placeholder="$t('Your sub-account description (optional)')" v-textarea-auto-size v-model:value="subAccount.comment" > @@ -398,7 +398,7 @@ - {{ $t('Add Sub Account') }} + {{ $t('Add Sub-account') }} {{ $t('Cancel') }} @@ -407,7 +407,7 @@ - {{ $t('Are you sure you want to remove this sub account?') }} + {{ $t('Are you sure you want to remove this sub-account?') }} {{ $t('Remove') }} @@ -567,7 +567,7 @@ export default { }, removeSubAccount(subAccount, confirm) { if (!subAccount) { - this.$alert('An error has occurred'); + this.$alert('An error occurred'); return; } @@ -676,13 +676,13 @@ export default { }, getInputEmptyProblemMessage(account, isSubAccount) { if (!isSubAccount && !account.category) { - return 'Account category cannot be empty'; + return 'Account category cannot be blank'; } else if (!isSubAccount && !account.type) { - return 'Account type cannot be empty'; + return 'Account type cannot be blank'; } else if (!account.name) { - return 'Account name cannot be empty'; + return 'Account name cannot be blank'; } else if (account.type === this.allAccountTypes.SingleAccount && !account.currency) { - return 'Account currency cannot be empty'; + return 'Account currency cannot be blank'; } else { return null; } diff --git a/src/views/mobile/accounts/ListPage.vue b/src/views/mobile/accounts/ListPage.vue index 749cd1d6..9190ed69 100644 --- a/src/views/mobile/accounts/ListPage.vue +++ b/src/views/mobile/accounts/ListPage.vue @@ -152,8 +152,8 @@ {{ $t('Sort') }} - {{ $t('Show Hidden Account') }} - {{ $t('Hide Hidden Account') }} + {{ $t('Show Hidden Accounts') }} + {{ $t('Hide Hidden Accounts') }} {{ $t('Cancel') }} @@ -408,7 +408,7 @@ export default { const self = this; if (!account) { - self.$alert('An error has occurred'); + self.$alert('An error occurred'); return; } diff --git a/src/views/mobile/categories/EditPage.vue b/src/views/mobile/categories/EditPage.vue index 259bf6c3..b98efafa 100644 --- a/src/views/mobile/categories/EditPage.vue +++ b/src/views/mobile/categories/EditPage.vue @@ -187,7 +187,7 @@ export default { }, inputEmptyProblemMessage() { if (!this.category.name) { - return 'Category name cannot be empty'; + return 'Category name cannot be blank'; } else { return null; } diff --git a/src/views/mobile/categories/ListPage.vue b/src/views/mobile/categories/ListPage.vue index 6f5d0d1f..c3b46cea 100644 --- a/src/views/mobile/categories/ListPage.vue +++ b/src/views/mobile/categories/ListPage.vue @@ -66,8 +66,8 @@ {{ $t('Sort') }} - {{ $t('Show Hidden Transaction Category') }} - {{ $t('Hide Hidden Transaction Category') }} + {{ $t('Show Hidden Transaction Categories') }} + {{ $t('Hide Hidden Transaction Categories') }} {{ $t('Cancel') }} @@ -357,7 +357,7 @@ export default { const self = this; if (!category) { - self.$alert('An error has occurred'); + self.$alert('An error occurred'); return; } diff --git a/src/views/mobile/statistics/SettingsPage.vue b/src/views/mobile/statistics/SettingsPage.vue index 4dbe7db2..8c56e889 100644 --- a/src/views/mobile/statistics/SettingsPage.vue +++ b/src/views/mobile/statistics/SettingsPage.vue @@ -37,8 +37,8 @@ + :title="$t('Default Sort Order')" + smart-select :smart-select-params="{ openIn: 'popup', popupPush: true, closeOnSelect: true, scrollToSelectedItem: true, searchbar: true, searchbarPlaceholder: $t('Sort Order'), searchbarDisableText: $t('Cancel'), appendSearchbarNotFound: $t('No results'), popupCloseLinkText: $t('Done') }">