ajout Dernières connexions pt
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user