Skip to content

Commit

Permalink
Fixes translation marking and adds more.
Browse files Browse the repository at this point in the history
Refs #415.
  • Loading branch information
chriz-uniba committed Jun 8, 2022
1 parent 380cd69 commit 4f02ce1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions invenio_accounts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""Default configuration for ACCOUNTS."""

from datetime import timedelta
from flask_babelex import lazy_gettext as _

from .profiles import UserPreferencesSchema, UserProfileSchema
from .views import login
Expand Down Expand Up @@ -196,23 +197,23 @@
SECURITY_CHANGE_URL = '/account/settings/password/'
"""URL endpoint for password change."""

SECURITY_MSG_LOCAL_LOGIN_DISABLED = ("Local login is disabled.", "error")
SECURITY_MSG_LOCAL_LOGIN_DISABLED = (_("Local login is disabled."), "error")
"""The error to be displayed in REST login when local login is disabled."""

SECURITY_MSG_REGISTRATION_DISABLED = ("Registration is disabled.", "error")
SECURITY_MSG_REGISTRATION_DISABLED = (_("Registration is disabled."), "error")
"""The error to be displayed in REST registration when it is disabled."""

SECURITY_MSG_PASSWORD_CHANGE_DISABLED = (
"Password change is disabled.", "error"
_("Password change is disabled."), "error"
)
"""The error to be displayed in REST password change when it is disabled."""

SECURITY_MSG_PASSWORD_RECOVERY_DISABLED = (
"Password recovery is disabled.", "error"
_("Password recovery is disabled."), "error"
)
"""The error to be displayed in REST password recovery when it is disabled."""

SECURITY_MSG_PASSWORD_RESET_DISABLED = ("Password reset is disabled.", "error")
SECURITY_MSG_PASSWORD_RESET_DISABLED = (_("Password reset is disabled."), "error")
"""The error to be displayed in REST password reset when it is disabled."""

REMEMBER_COOKIE_DURATION = timedelta(days=90)
Expand Down Expand Up @@ -323,8 +324,8 @@
"""

ACCOUNTS_USERNAME_RULES_TEXT = (
'Username must start with a letter, be at least three characters long and'
' only contain alphanumeric characters, dashes and underscores.'
_('Username must start with a letter, be at least three characters long'
' and only contain alphanumeric characters, dashes and underscores.')
)
"""Description of username validation rules.
Expand Down
2 changes: 1 addition & 1 deletion invenio_accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,5 @@ def validate_username(username):
if not re.fullmatch(username_regex, username):
# if validation fails, we raise a ValueError with the configured
# text explaining the validation rules.
message = _(current_app.config["ACCOUNTS_USERNAME_RULES_TEXT"])
message = current_app.config["ACCOUNTS_USERNAME_RULES_TEXT"]
raise ValueError(message)

0 comments on commit 4f02ce1

Please sign in to comment.