From 253c5c2491c02e012129484d86ab701c284ec260 Mon Sep 17 00:00:00 2001 From: aitzol Date: Wed, 29 Nov 2023 23:30:29 +0100 Subject: [PATCH] lastlogin attribute --- app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 8ddb61a..1493541 100644 --- a/app.py +++ b/app.py @@ -1034,7 +1034,10 @@ def get_user_data(user_dn, conn): #ts = conn.entries[0].lastLogin.values[0] #ts = datetime.strptime(ts, '%Y-%m-%d %H:%M:%S%z') #ts = datetime.strftime(t, '%Y-%m-%d %H:%M:%S') - data.append(str(conn.entries[0].lastLogin.values[0])[:-6]) + if(conn.entries[0].lastLogin): + data.append(str(conn.entries[0].lastLogin.values[0])[:-6]) + else: + data.append(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) data.append(conn.entries[0].secureAuth.values[0]) if(conn.entries[0].authCode): data.append(conn.entries[0].authCode.values[0])