Add translatable errors for the email policy constraints
This commit is contained in:
@@ -37,6 +37,12 @@ pub enum Code {
|
||||
|
||||
/// The email domain is banned.
|
||||
EmailDomainBanned,
|
||||
|
||||
/// The email address is not allowed.
|
||||
EmailNotAllowed,
|
||||
|
||||
/// The email address is banned.
|
||||
EmailBanned,
|
||||
}
|
||||
|
||||
impl Code {
|
||||
@@ -50,6 +56,8 @@ impl Code {
|
||||
Self::UsernameAllNumeric => "username-all-numeric",
|
||||
Self::EmailDomainNotAllowed => "email-domain-not-allowed",
|
||||
Self::EmailDomainBanned => "email-domain-banned",
|
||||
Self::EmailNotAllowed => "email-not-allowed",
|
||||
Self::EmailBanned => "email-banned",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@ Please see LICENSE in the repository root for full details.
|
||||
{{ _("mas.errors.email_domain_not_allowed") }}
|
||||
{% elif error.code == "email-domain-banned" %}
|
||||
{{ _("mas.errors.email_domain_banned") }}
|
||||
{% elif error.code == "email-not-allowed" %}
|
||||
{{ _("mas.errors.email_not_allowed") }}
|
||||
{% elif error.code == "email-banned" %}
|
||||
{{ _("mas.errors.email_banned") }}
|
||||
{% else %}
|
||||
{{ _("mas.errors.denied_policy", policy=error.message) }}
|
||||
{% endif %}
|
||||
|
||||
@@ -299,7 +299,11 @@
|
||||
},
|
||||
"denied_policy": "Denied by policy: %(policy)s",
|
||||
"@denied_policy": {
|
||||
"context": "components/errors.html:17:7-58, components/field.html:77:19-70"
|
||||
"context": "components/errors.html:17:7-58, components/field.html:81:19-70"
|
||||
},
|
||||
"email_banned": "Email is banned by the server policy",
|
||||
"@email_banned": {
|
||||
"context": "components/field.html:79:19-47"
|
||||
},
|
||||
"email_domain_banned": "Email domain is banned by the server policy",
|
||||
"@email_domain_banned": {
|
||||
@@ -309,6 +313,10 @@
|
||||
"@email_domain_not_allowed": {
|
||||
"context": "components/field.html:73:19-59"
|
||||
},
|
||||
"email_not_allowed": "Email is not allowed by the server policy",
|
||||
"@email_not_allowed": {
|
||||
"context": "components/field.html:77:19-52"
|
||||
},
|
||||
"field_required": "This field is required",
|
||||
"@field_required": {
|
||||
"context": "components/field.html:60:17-47"
|
||||
@@ -319,7 +327,7 @@
|
||||
},
|
||||
"password_mismatch": "Password fields don't match",
|
||||
"@password_mismatch": {
|
||||
"context": "components/errors.html:13:7-40, components/field.html:80:17-50"
|
||||
"context": "components/errors.html:13:7-40, components/field.html:84:17-50"
|
||||
},
|
||||
"rate_limit_exceeded": "You've made too many requests in a short period. Please wait a few minutes and try again.",
|
||||
"@rate_limit_exceeded": {
|
||||
@@ -416,7 +424,7 @@
|
||||
},
|
||||
"or_separator": "Or",
|
||||
"@or_separator": {
|
||||
"context": "components/field.html:99:10-31",
|
||||
"context": "components/field.html:103:10-31",
|
||||
"description": "Separator between the login methods"
|
||||
},
|
||||
"policy_violation": {
|
||||
|
||||
Reference in New Issue
Block a user