Ejemplo n.º 1
0
def set_gaema_user(service, user):
  gaema_user_key = GAEMA_USER_KEY_FORMAT % service
  if hasattr(settings, "GAEMA_STORAGE") and settings.GAEMA_STORAGE == "cookie":
    secure_cookie = SecureCookie(user, secret_key=settings.SECRET_KEY)
    user_data = secure_cookie.serialize()
    set_cookie(gaema_user_key, user_data)
  else:
    from kay.sessions import renew_session
    renew_session(local.request)
    local.request.session[gaema_user_key] = user
    local.request.session.modified = True
Ejemplo n.º 2
0
def set_gaema_user(service, user):
    gaema_user_key = GAEMA_USER_KEY_FORMAT % service
    if hasattr(settings,
               "GAEMA_STORAGE") and settings.GAEMA_STORAGE == "cookie":
        secure_cookie = SecureCookie(user, secret_key=settings.SECRET_KEY)
        user_data = secure_cookie.serialize()
        set_cookie(gaema_user_key, user_data)
    else:
        from kay.sessions import renew_session
        renew_session(local.request)
        local.request.session[gaema_user_key] = user
        local.request.session.modified = True
Ejemplo n.º 3
0
def post_session(request):
    if request.method == "GET":
        from models import TemporarySession
        temporary_session = TemporarySession.get_by_key_name(
            request.values.get("session_id"))
        if temporary_session is not None:
            temporary_session.delete()
            import datetime
            allowed_datetime = datetime.datetime.now() - \
                datetime.timedelta(seconds=10)
            if temporary_session.created > allowed_datetime:
                from kay.sessions import renew_session
                renew_session(request)
                request.session['_user'] = temporary_session.user.key()
                return redirect(unquote_plus(request.values.get('next')))
    return Response("Error")
Ejemplo n.º 4
0
def post_session(request):
  if request.method == "GET":
    from models import TemporarySession
    temporary_session = TemporarySession.get_by_key_name(
      request.values.get("session_id"))
    if temporary_session is not None:
      temporary_session.delete()
      import datetime
      allowed_datetime = datetime.datetime.now() - \
          datetime.timedelta(seconds=10)
      if temporary_session.created > allowed_datetime:
        from kay.sessions import renew_session
        renew_session(request)
        request.session['_user'] = temporary_session.user.key()
        return redirect(unquote_plus(request.values.get('next')))
  return Response("Error")
Ejemplo n.º 5
0
 def store_user(self, user):
     from kay.sessions import renew_session
     renew_session(local.request)
     local.request.session['_user'] = user.user_name
     return True
Ejemplo n.º 6
0
 def store_user(self, user):
   from kay.sessions import renew_session
   renew_session(local.request)
   local.request.session['_user'] = user.key()
   return True