小编Pay*_*aam的帖子

Django在登录时发出信号

用于登录功能的django信号是什么?用户已添加到请求会话表中.那么在Django auth.login函数中对signal的最后一行调用是什么?

 @sensitive_post_parameters() 
 @csrf_protect
 @never_cache
 def login(request, user):
  """
  Persist a user id and a backend in the request. This way a user doesn't
  have to reauthenticate on every request. Note that data set during
  the anonymous session is retained when the user logs in.
  """
  session_auth_hash = ''
  if user is None:
     user = request.user
  if hasattr(user, 'get_session_auth_hash'):
     session_auth_hash = user.get_session_auth_hash()

  if SESSION_KEY in request.session:
    if _get_user_session_key(request) != user.pk or (
            session_auth_hash and
            request.session.get(HASH_SESSION_KEY) != session_auth_hash):
        # To avoid …
Run Code Online (Sandbox Code Playgroud)

django session signals login

3
推荐指数
1
解决办法
3540
查看次数

标签 统计

django ×1

login ×1

session ×1

signals ×1