From 69e20fa114cbb509ae911d930c50b751c5f255aa Mon Sep 17 00:00:00 2001 From: Julien Jershon Date: Sat, 5 Oct 2019 10:29:01 +0200 Subject: [PATCH 1/4] Update the email regex so it accept the '+' sign. Fix https://github.com/YunoHost/issues/issues/1333. --- data/actionsmap/yunohost.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 08416b69f..72b30328c 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -100,6 +100,12 @@ user: -m: full: --mail help: (Deprecated, see --domain) Main unique email address + extra: + ask: ask_email + required: True + pattern: &pattern_email_without_plus + - !!str ^[\w.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ + - "pattern_email_without_plus" -p: full: --password help: User password @@ -158,9 +164,7 @@ user: -m: full: --mail extra: - pattern: &pattern_email - - !!str ^[\w.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+((xn--)?[^\W_]{2,})$ - - "pattern_email" + pattern: *pattern_email_without_plus -p: full: --change-password help: New password to set @@ -172,7 +176,9 @@ user: nargs: "*" metavar: MAIL extra: - pattern: *pattern_email + pattern: &pattern_email + - !!str ^[\w\+.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ + - "pattern_email" --remove-mailforward: help: Mailforward addresses to remove nargs: "*" @@ -182,7 +188,7 @@ user: nargs: "*" metavar: MAIL extra: - pattern: *pattern_email + pattern: *pattern_email_without_plus --remove-mailalias: help: Mail aliases to remove nargs: "*" From 4510b2b913427f56a5b566fe14805085455eb2b3 Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 23 Sep 2020 02:03:46 +0200 Subject: [PATCH 2/4] [fix] Add pattern email desc --- locales/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 1a620124b..e832b5ec8 100644 --- a/locales/en.json +++ b/locales/en.json @@ -468,7 +468,8 @@ "password_too_simple_4": "The password needs to be at least 12 characters long and contain a digit, upper, lower and special characters", "pattern_backup_archive_name": "Must be a valid filename with max 30 characters, alphanumeric and -_. characters only", "pattern_domain": "Must be a valid domain name (e.g. my-domain.org)", - "pattern_email": "Must be a valid e-mail address (e.g. someone@example.com)", + "pattern_email": "Must be a valid e-mail address, '+' symbol accepted(e.g. someone+tag@example.com)", + "pattern_email_without_plus": "Must be a valid e-mail address without '+' symbol (e.g. someone@example.com)", "pattern_firstname": "Must be a valid first name", "pattern_lastname": "Must be a valid last name", "pattern_mailbox_quota": "Must be a size with b/k/M/G/T suffix or 0 to not have a quota", From c0234a75f52149d2b6650d6cecf566a2703579cc Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 23 Sep 2020 21:46:31 +0200 Subject: [PATCH 3/4] Better naming ? :s --- data/actionsmap/yunohost.yml | 12 ++++++------ locales/en.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 72b30328c..7be0e0899 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -103,9 +103,9 @@ user: extra: ask: ask_email required: True - pattern: &pattern_email_without_plus + pattern: &pattern_email - !!str ^[\w.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ - - "pattern_email_without_plus" + - "pattern_email" -p: full: --password help: User password @@ -164,7 +164,7 @@ user: -m: full: --mail extra: - pattern: *pattern_email_without_plus + pattern: *pattern_email -p: full: --change-password help: New password to set @@ -176,9 +176,9 @@ user: nargs: "*" metavar: MAIL extra: - pattern: &pattern_email + pattern: &pattern_email_forward - !!str ^[\w\+.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ - - "pattern_email" + - "pattern_email_forward" --remove-mailforward: help: Mailforward addresses to remove nargs: "*" @@ -188,7 +188,7 @@ user: nargs: "*" metavar: MAIL extra: - pattern: *pattern_email_without_plus + pattern: *pattern_email --remove-mailalias: help: Mail aliases to remove nargs: "*" diff --git a/locales/en.json b/locales/en.json index e832b5ec8..115928001 100644 --- a/locales/en.json +++ b/locales/en.json @@ -468,8 +468,8 @@ "password_too_simple_4": "The password needs to be at least 12 characters long and contain a digit, upper, lower and special characters", "pattern_backup_archive_name": "Must be a valid filename with max 30 characters, alphanumeric and -_. characters only", "pattern_domain": "Must be a valid domain name (e.g. my-domain.org)", - "pattern_email": "Must be a valid e-mail address, '+' symbol accepted(e.g. someone+tag@example.com)", - "pattern_email_without_plus": "Must be a valid e-mail address without '+' symbol (e.g. someone@example.com)", + "pattern_email_forward": "Must be a valid e-mail address, '+' symbol accepted (e.g. someone+tag@example.com)", + "pattern_email": "Must be a valid e-mail address, without '+' symbol (e.g. someone@example.com)", "pattern_firstname": "Must be a valid first name", "pattern_lastname": "Must be a valid last name", "pattern_mailbox_quota": "Must be a size with b/k/M/G/T suffix or 0 to not have a quota", From b48f6521e2cf532a1da0ab76cc51c9834998a10a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 23 Sep 2020 21:53:06 +0200 Subject: [PATCH 4/4] Removing the pattern/required flag from --mail in user_create was intentional because it's now deprecated ... + restablish support xn-- stuff... --- data/actionsmap/yunohost.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 7be0e0899..5371d576d 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -100,12 +100,6 @@ user: -m: full: --mail help: (Deprecated, see --domain) Main unique email address - extra: - ask: ask_email - required: True - pattern: &pattern_email - - !!str ^[\w.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ - - "pattern_email" -p: full: --password help: User password @@ -164,7 +158,9 @@ user: -m: full: --mail extra: - pattern: *pattern_email + pattern: &pattern_email + - !!str ^[\w.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+((xn--)?[^\W_]{2,})$ + - "pattern_email" -p: full: --change-password help: New password to set @@ -177,7 +173,7 @@ user: metavar: MAIL extra: pattern: &pattern_email_forward - - !!str ^[\w\+.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ + - !!str ^[\w\+.-]+@([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+((xn--)?[^\W_]{2,})$ - "pattern_email_forward" --remove-mailforward: help: Mailforward addresses to remove