fixing phantom account existing

This commit is contained in:
Cayo Puigdefabregas 2021-04-09 22:21:13 +02:00
parent a882396f09
commit 22633054ba

View file

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