|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
from mailu import manager, db
|
|
|
|
|
from mailu.admin import models
|
|
|
|
|
from passlib import hash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
@ -28,12 +27,13 @@ def admin(localpart, domain_name, password):
|
|
|
|
|
user = models.User(
|
|
|
|
|
localpart=localpart,
|
|
|
|
|
domain=domain,
|
|
|
|
|
global_admin=True,
|
|
|
|
|
password=hash.sha512_crypt.encrypt(password)
|
|
|
|
|
global_admin=True
|
|
|
|
|
)
|
|
|
|
|
user.set_password(password)
|
|
|
|
|
db.session.add(user)
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
|
def user(localpart, domain_name, password):
|
|
|
|
|
""" Create an user
|
|
|
|
@ -45,12 +45,13 @@ def user(localpart, domain_name, password):
|
|
|
|
|
user = models.User(
|
|
|
|
|
localpart=localpart,
|
|
|
|
|
domain=domain,
|
|
|
|
|
global_admin=False,
|
|
|
|
|
password=hash.sha512_crypt.encrypt(password)
|
|
|
|
|
global_admin=False
|
|
|
|
|
)
|
|
|
|
|
user.set_password(password)
|
|
|
|
|
db.session.add(user)
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
|
def alias(localpart, domain_name, destination):
|
|
|
|
|
""" Create an alias
|
|
|
|
@ -68,5 +69,6 @@ def alias(localpart, domain_name, destination):
|
|
|
|
|
db.session.add(alias)
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
manager.run()
|
|
|
|
|