Polish UX

This commit is contained in:
Alexandre Aubin 2020-08-27 17:31:33 +02:00
parent 4a15358ed9
commit dea6a18712
3 changed files with 11 additions and 5 deletions

View file

@ -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,})$

View file

@ -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",

View file

@ -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']: