From 17a744a6603a261fc6c837ef8cf47304cba89e46 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 8 Apr 2021 21:19:24 +0200 Subject: [PATCH] add filter active and phantom for login view --- ereuse_devicehub/resources/user/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/user/views.py b/ereuse_devicehub/resources/user/views.py index 7053eea7..8eadc863 100644 --- a/ereuse_devicehub/resources/user/views.py +++ b/ereuse_devicehub/resources/user/views.py @@ -18,7 +18,7 @@ def login(): user_s = g.resource_def.SCHEMA(only=('email', 'password')) # type: UserS # noinspection PyArgumentList u = request.get_json(schema=user_s) - user = User.query.filter_by(email=u['email']).one_or_none() + user = User.query.filter_by(email=u['email'], active=True, phantom=False).one_or_none() if user and user.password == u['password']: schema_with_token = g.resource_def.SCHEMA(exclude=set()) return schema_with_token.jsonify(user)