You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-06-23 00:28:06 +02:00
Update password in commandline
This commit is contained in:
@ -85,6 +85,26 @@ def user(localpart, domain_name, password, hash_scheme=None):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@mailu.command()
|
||||||
|
@click.argument('localpart')
|
||||||
|
@click.argument('domain_name')
|
||||||
|
@click.argument('password')
|
||||||
|
@click.argument('hash_scheme', required=False)
|
||||||
|
@flask_cli.with_appcontext
|
||||||
|
def password(localpart, domain_name, password, hash_scheme=None):
|
||||||
|
""" Change the password of an user
|
||||||
|
"""
|
||||||
|
email = '{0}@{1}'.format(localpart, domain_name)
|
||||||
|
user = models.User.query.get(email)
|
||||||
|
if hash_scheme is None:
|
||||||
|
hash_scheme = app.config['PASSWORD_SCHEME']
|
||||||
|
if user:
|
||||||
|
user.set_password(password, hash_scheme=hash_scheme)
|
||||||
|
else:
|
||||||
|
print("User " + email + " not found.")
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
@mailu.command()
|
@mailu.command()
|
||||||
@click.argument('domain_name')
|
@click.argument('domain_name')
|
||||||
@click.option('-u', '--max-users')
|
@click.option('-u', '--max-users')
|
||||||
|
@ -6,6 +6,7 @@ Managing users and aliases can be done from CLI using commands:
|
|||||||
* alias
|
* alias
|
||||||
* alias-delete
|
* alias-delete
|
||||||
* domain
|
* domain
|
||||||
|
* password
|
||||||
* user
|
* user
|
||||||
* user-import
|
* user-import
|
||||||
* user-delete
|
* user-delete
|
||||||
@ -35,6 +36,14 @@ domain
|
|||||||
docker-compose exec admin flask mailu domain example.net
|
docker-compose exec admin flask mailu domain example.net
|
||||||
|
|
||||||
|
|
||||||
|
password
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
docker-compose exec admin flask mailu password myuser example.net 'password123'
|
||||||
|
|
||||||
|
|
||||||
user
|
user
|
||||||
----
|
----
|
||||||
|
|
||||||
|
1
towncrier/newsfragments/1066.feature
Normal file
1
towncrier/newsfragments/1066.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Update user password in commandline
|
Reference in New Issue
Block a user