ajout Dernières connexions pt

This commit is contained in:
2019-01-04 18:51:23 +01:00
parent 54fa91f288
commit 46c235cb2d
10 changed files with 89 additions and 65 deletions

View File

@@ -20,6 +20,7 @@ from datetime import *
import hashlib
from sqlalchemy.exc import DBAPIError
from ..security import groupfinder
from user_agents import parse
import json
@@ -181,10 +182,14 @@ def login(request):
if record :
# mot de passe hash valide ?
if record.mdp == to_sha1(password):
update_last_connection(request, login)
# get user agent string from request
ua_string = request.user_agent
user_agent = parse(ua_string)
update_last_connection(request, login, str(user_agent))
# force le commit car il ne se fait pas automatiquement après l'update
transaction.commit()
headers = remember(request, login)
return HTTPFound(location=came_from, headers=headers)