mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 08:58:30 +01:00
fix api create new custom alias
This commit is contained in:
parent
ac9f896a7d
commit
d9c211d8da
2 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ def new_custom_alias():
|
||||||
user = g.user
|
user = g.user
|
||||||
if not user.can_create_new_custom_alias():
|
if not user.can_create_new_custom_alias():
|
||||||
LOG.d("user %s cannot create custom alias", user)
|
LOG.d("user %s cannot create custom alias", user)
|
||||||
return jsonify(error="no more quota for custom alias"), 400
|
return jsonify(error="You have created 3 custom aliases, please upgrade to create more"), 400
|
||||||
|
|
||||||
user_custom_domains = [cd.domain for cd in user.verified_custom_domains()]
|
user_custom_domains = [cd.domain for cd in user.verified_custom_domains()]
|
||||||
hostname = request.args.get("hostname")
|
hostname = request.args.get("hostname")
|
||||||
|
@ -69,7 +69,7 @@ def new_custom_alias():
|
||||||
LOG.d("full alias already used %s", full_alias)
|
LOG.d("full alias already used %s", full_alias)
|
||||||
return jsonify(error=f"alias {full_alias} already exists"), 409
|
return jsonify(error=f"alias {full_alias} already exists"), 409
|
||||||
|
|
||||||
gen_email = GenEmail.create(user_id=user.id, email=full_alias)
|
gen_email = GenEmail.create(user_id=user.id, email=full_alias, custom=True)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if hostname:
|
if hostname:
|
||||||
|
|
|
@ -24,7 +24,7 @@ def new_random_alias():
|
||||||
user = g.user
|
user = g.user
|
||||||
if not user.can_create_new_random_alias():
|
if not user.can_create_new_random_alias():
|
||||||
LOG.d("user %s cannot create random alias", user)
|
LOG.d("user %s cannot create random alias", user)
|
||||||
return jsonify(error="no more quota for random alias"), 400
|
return jsonify(error="You have created 3 random aliases, please upgrade to create more"), 400
|
||||||
|
|
||||||
hostname = request.args.get("hostname")
|
hostname = request.args.get("hostname")
|
||||||
gen_email = GenEmail.create_new_gen_email(user_id=user.id)
|
gen_email = GenEmail.create_new_gen_email(user_id=user.id)
|
||||||
|
|
Loading…
Reference in a new issue