From 22633054ba155a5ea46d2eca53c0981af20cdb98 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 9 Apr 2021 22:21:13 +0200 Subject: [PATCH] fixing phantom account existing --- ereuse_devicehub/resources/action/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/action/views.py b/ereuse_devicehub/resources/action/views.py index 050e6c2d..63439489 100644 --- a/ereuse_devicehub/resources/action/views.py +++ b/ereuse_devicehub/resources/action/views.py @@ -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)