def connect_user(request, form_datas): """ Effectively connect the user :param obj request: The pyramid Request object :pram dict form_datas: Validated form_datas """ login = form_datas['login'] login_id = Login.id_from_login(login) log.info( u" + '{0}' id : {1} has been authenticated".format( login, login_id ) ) # Storing the form_datas in the request object remember(request, login) remember_me = form_datas.get('remember_me', False) if remember_me: log.info(" * The user wants to be remembered") longtimeout = get_longtimeout() request.response.set_cookie( 'remember_me', "ok", max_age=longtimeout, )
def connect_user(request, form_datas): """ Effectively connect the user :param obj request: The pyramid Request object :pram dict form_datas: Validated form_datas """ login = form_datas['login'] login_id = Login.id_from_login(login) log.info(u" + '{0}' id : {1} has been authenticated".format( login, login_id)) # Storing the form_datas in the request object remember(request, login) remember_me = form_datas.get('remember_me', False) if remember_me: log.info(" * The user wants to be remembered") longtimeout = get_longtimeout() request.response.set_cookie( 'remember_me', "ok", max_age=longtimeout, )
def test_id_from_login(dbsession, login): assert Login.id_from_login(login.login) == login.id with pytest.raises(Exception): Login.id_from_login("wrong login")