Browse Source

fix api create new custom alias

Son NK 5 years ago
parent
commit
d9c211d8da
2 changed files with 3 additions and 3 deletions
  1. 2 2
      app/api/views/new_custom_alias.py
  2. 1 1
      app/api/views/new_random_alias.py

+ 2 - 2
app/api/views/new_custom_alias.py

@@ -28,7 +28,7 @@ def new_custom_alias():
     user = g.user
     if not user.can_create_new_custom_alias():
         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()]
     hostname = request.args.get("hostname")
@@ -69,7 +69,7 @@ def new_custom_alias():
         LOG.d("full alias already used %s", full_alias)
         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()
 
     if hostname:

+ 1 - 1
app/api/views/new_random_alias.py

@@ -24,7 +24,7 @@ def new_random_alias():
     user = g.user
     if not user.can_create_new_random_alias():
         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")
     gen_email = GenEmail.create_new_gen_email(user_id=user.id)