From abb8ab84cd948edbe9e678aebbaa5a59681c5adc Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 2 May 2024 04:56:27 +0300 Subject: use dataclasses' asdict() function. --- gn_auth/auth/authorisation/users/admin/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn_auth') diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py index f343da1..a4c4033 100644 --- a/gn_auth/auth/authorisation/users/admin/views.py +++ b/gn_auth/auth/authorisation/users/admin/views.py @@ -5,6 +5,7 @@ import random import string from typing import Optional from functools import partial +from dataclasses import asdict from urllib.parse import urlparse from datetime import datetime, timezone, timedelta @@ -80,7 +81,7 @@ def login(): user = user_by_email(conn, email["email"]) if valid_login(conn, user, password): session.update_session_info( - user=user._asdict(), + user=asdict(user), expires=( datetime.now(tz=timezone.utc) + timedelta(minutes=10))) return redirect(url_for(next_uri)) -- cgit v1.2.3