mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Reimplement --mail as a deprecated option
This commit is contained in:
parent
3fc4baa08f
commit
5805acbf6a
2 changed files with 8 additions and 21 deletions
|
@ -97,6 +97,9 @@ user:
|
||||||
pattern: &pattern_lastname
|
pattern: &pattern_lastname
|
||||||
- !!str ^([^\W\d_]{2,30}[ ,.'-]{0,3})+$
|
- !!str ^([^\W\d_]{2,30}[ ,.'-]{0,3})+$
|
||||||
- "pattern_lastname"
|
- "pattern_lastname"
|
||||||
|
-m:
|
||||||
|
full: --mail
|
||||||
|
help: (Deprecated, see --domain) Main unique email address
|
||||||
-p:
|
-p:
|
||||||
full: --password
|
full: --password
|
||||||
help: User password
|
help: User password
|
||||||
|
|
|
@ -46,16 +46,7 @@ logger = getActionLogger('yunohost.user')
|
||||||
|
|
||||||
|
|
||||||
def user_list(fields=None):
|
def user_list(fields=None):
|
||||||
"""
|
|
||||||
List users
|
|
||||||
|
|
||||||
Keyword argument:
|
|
||||||
filter -- LDAP filter used to search
|
|
||||||
offset -- Starting number for user fetching
|
|
||||||
limit -- Maximum number of user fetched
|
|
||||||
fields -- fields to fetch
|
|
||||||
|
|
||||||
"""
|
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
|
||||||
user_attrs = {
|
user_attrs = {
|
||||||
|
@ -106,19 +97,8 @@ def user_list(fields=None):
|
||||||
|
|
||||||
@is_unit_operation([('username', 'user')])
|
@is_unit_operation([('username', 'user')])
|
||||||
def user_create(operation_logger, username, firstname, lastname, domain, password,
|
def user_create(operation_logger, username, firstname, lastname, domain, password,
|
||||||
mailbox_quota="0"):
|
mailbox_quota="0", mail=None):
|
||||||
"""
|
|
||||||
Create user
|
|
||||||
|
|
||||||
Keyword argument:
|
|
||||||
firstname
|
|
||||||
lastname
|
|
||||||
username -- Must be unique
|
|
||||||
mail -- Main mail address must be unique
|
|
||||||
password
|
|
||||||
mailbox_quota -- Mailbox size quota
|
|
||||||
|
|
||||||
"""
|
|
||||||
from yunohost.domain import domain_list, _get_maindomain
|
from yunohost.domain import domain_list, _get_maindomain
|
||||||
from yunohost.hook import hook_callback
|
from yunohost.hook import hook_callback
|
||||||
from yunohost.utils.password import assert_password_is_strong_enough
|
from yunohost.utils.password import assert_password_is_strong_enough
|
||||||
|
@ -127,6 +107,10 @@ def user_create(operation_logger, username, firstname, lastname, domain, passwor
|
||||||
# Ensure sufficiently complex password
|
# Ensure sufficiently complex password
|
||||||
assert_password_is_strong_enough("user", password)
|
assert_password_is_strong_enough("user", password)
|
||||||
|
|
||||||
|
if mail is not None:
|
||||||
|
logger.warning("Packagers ! Using --mail in 'yunohost user create' is deprecated ... please use --domain instead.")
|
||||||
|
domain = mail.split("@")[-1]
|
||||||
|
|
||||||
# Validate domain used for email address/xmpp account
|
# Validate domain used for email address/xmpp account
|
||||||
if domain is None:
|
if domain is None:
|
||||||
if msettings.get('interface') == 'api':
|
if msettings.get('interface') == 'api':
|
||||||
|
|
Loading…
Add table
Reference in a new issue