diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 803c5bfda..e2439b2dc 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -109,7 +109,7 @@ user: comment: good_practices_about_user_password -d: full: --domain - help: Domain for email and xmpp + help: Domain for the email address and xmpp account extra: pattern: &pattern_domain - !!str ^([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+([^\W\d_]{2,})$ diff --git a/locales/en.json b/locales/en.json index afc9db13a..20bad0a8f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -60,7 +60,7 @@ "apps_catalog_failed_to_download": "Unable to download the {apps_catalog} app catalog: {error}", "apps_catalog_obsolete_cache": "The app catalog cache is empty or obsolete.", "apps_catalog_update_success": "The application catalog has been updated!", - "ask_domain": "Choose a domain", + "ask_user_domain": "Domain to use for the user's email address and XMPP account", "ask_email": "E-mail address", "ask_firstname": "First name", "ask_lastname": "Last name", diff --git a/src/yunohost/user.py b/src/yunohost/user.py index 98dafc24d..2f5c13d97 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -127,14 +127,20 @@ def user_create(operation_logger, username, firstname, lastname, domain, passwor # Ensure sufficiently complex password assert_password_is_strong_enough("user", password) + # Validate domain used for email address/xmpp account if domain is None: if msettings.get('interface') == 'api': raise YunohostError('Invalide usage, specify domain argument') else: # On affiche les differents domaines possibles - for domain_checked in domain_list()['domains'] : - msignals.display("- {}".format(domain_checked)) - domain = msignals.prompt(m18n.n('ask_domain')) + msignals.display(m18n.n('domains_available')) + for domain in domain_list()['domains']: + msignals.display("- {}".format(domain)) + + maindomain = _get_maindomain() + domain = msignals.prompt(m18n.n('ask_user_domain') + ' (default: %s)' % maindomain) + if not domain: + domain = maindomain # Check that the domain exists if domain not in domain_list()['domains']: