[1/3] Update last login information on SSO login

Message ID 20200728143312.GA564577@tsubame.mg0.fr
State New
Headers show
Series
  • [1/3] Update last login information on SSO login
Related show

Commit Message

Frédéric Mangano-Tarumi July 28, 2020, 2:33 p.m. UTC
---
 aurweb/routers/sso.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Lukas Fleischer July 29, 2020, 12:46 a.m. UTC | #1
On Tue, 28 Jul 2020 at 10:33:12, Frédéric Mangano-Tarumi wrote:
> ---
>  aurweb/routers/sso.py | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Merged all three patches in this patch set, thanks!

Patch

diff --git a/aurweb/routers/sso.py b/aurweb/routers/sso.py
index 7b9c67c8..817adadb 100644
--- a/aurweb/routers/sso.py
+++ b/aurweb/routers/sso.py
@@ -63,7 +63,13 @@  def open_session(request, conn, user_id):
         SessionID=sid,
         LastUpdateTS=time.time(),
     ))
-    # TODO update Users.LastLogin and Users.LastLoginIPAddress
+
+    # Update user’s last login information.
+    conn.execute(Users.update()
+                      .where(Users.c.ID == user_id)
+                      .values(LastLogin=int(time.time()),
+                              LastLoginIPAddress=request.client.host))
+
     return sid