fixing phantom account existing

This commit is contained in:
Cayo Puigdefabregas 2021-04-09 22:21:13 +02:00
parent a882396f09
commit 22633054ba
1 changed files with 3 additions and 2 deletions

View File

@ -369,11 +369,12 @@ class ActionView(View):
return
if offer.user_from_id and not offer.user_to_id:
assert g.user.id == offer.user_from_id
email = "{}_{}@dhub.com".format(str(offer.user_from_id), offer.code)
users = User.query.filter_by(email=email)
if users.first():
user = users.first()
offer.user_to_id = user.id
offer.user_to = user
return
user = User(email=email, password='', active=False, phantom=True)
@ -385,7 +386,7 @@ class ActionView(View):
users = User.query.filter_by(email=email)
if users.first():
user = users.first()
offer.user_from_id = user.id
offer.user_from = user
return
user = User(email=email, password='', active=False, phantom=True)