Skip to content

Commit e3b7642

Browse files
committed
Show proper error messages when registering with a banned/not-allowed username
1 parent 6e881d6 commit e3b7642

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

templates/components/field.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
{{ _("mas.errors.username_invalid_chars") }}
7070
{% elif error.code == "username-all-numeric" %}
7171
{{ _("mas.errors.username_all_numeric") }}
72+
{% elif error.code == "username-banned" %}
73+
{{ _("mas.errors.username_banned") }}
74+
{% elif error.code == "username-not-allowed" %}
75+
{{ _("mas.errors.username_not_allowed") }}
7276
{% elif error.code == "email-domain-not-allowed" %}
7377
{{ _("mas.errors.email_domain_not_allowed") }}
7478
{% elif error.code == "email-domain-banned" %}

translations/en.json

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,23 +299,23 @@
299299
},
300300
"denied_policy": "Denied by policy: %(policy)s",
301301
"@denied_policy": {
302-
"context": "components/errors.html:17:7-58, components/field.html:81:19-70"
302+
"context": "components/errors.html:17:7-58, components/field.html:85:19-70"
303303
},
304304
"email_banned": "Email is banned by the server policy",
305305
"@email_banned": {
306-
"context": "components/field.html:79:19-47"
306+
"context": "components/field.html:83:19-47"
307307
},
308308
"email_domain_banned": "Email domain is banned by the server policy",
309309
"@email_domain_banned": {
310-
"context": "components/field.html:75:19-54"
310+
"context": "components/field.html:79:19-54"
311311
},
312312
"email_domain_not_allowed": "Email domain is not allowed by the server policy",
313313
"@email_domain_not_allowed": {
314-
"context": "components/field.html:73:19-59"
314+
"context": "components/field.html:77:19-59"
315315
},
316316
"email_not_allowed": "Email is not allowed by the server policy",
317317
"@email_not_allowed": {
318-
"context": "components/field.html:77:19-52"
318+
"context": "components/field.html:81:19-52"
319319
},
320320
"field_required": "This field is required",
321321
"@field_required": {
@@ -327,7 +327,7 @@
327327
},
328328
"password_mismatch": "Password fields don't match",
329329
"@password_mismatch": {
330-
"context": "components/errors.html:13:7-40, components/field.html:84:17-50"
330+
"context": "components/errors.html:13:7-40, components/field.html:88:17-50"
331331
},
332332
"rate_limit_exceeded": "You've made too many requests in a short period. Please wait a few minutes and try again.",
333333
"@rate_limit_exceeded": {
@@ -337,10 +337,20 @@
337337
"@username_all_numeric": {
338338
"context": "components/field.html:71:19-55"
339339
},
340+
"username_banned": "Username is banned by the server policy",
341+
"@username_banned": {
342+
"context": "components/field.html:73:19-50",
343+
"description": "Error message shown on registration, when the username matches a pattern that is banned by the server policy."
344+
},
340345
"username_invalid_chars": "Username contains invalid characters. Use lowercase letters, numbers, dashes and underscores only.",
341346
"@username_invalid_chars": {
342347
"context": "components/field.html:69:19-57"
343348
},
349+
"username_not_allowed": "Username is not allowed by the server policy",
350+
"@username_not_allowed": {
351+
"context": "components/field.html:75:19-55",
352+
"description": "Error message shown on registration, when the username *does not match* any of the patterns that are allowed by the server policy."
353+
},
344354
"username_taken": "This username is already taken",
345355
"@username_taken": {
346356
"context": "components/field.html:62:17-47"
@@ -424,7 +434,7 @@
424434
},
425435
"or_separator": "Or",
426436
"@or_separator": {
427-
"context": "components/field.html:103:10-31",
437+
"context": "components/field.html:107:10-31",
428438
"description": "Separator between the login methods"
429439
},
430440
"policy_violation": {

0 commit comments

Comments
 (0)