<output id="11161"><video id="11161"></video></output>

<code id="11161"></code>

    <cite id="11161"><video id="11161"></video></cite>

      <dd id="11161"><samp id="11161"><rp id="11161"></rp></samp></dd>
    1. <output id="11161"><tr id="11161"></tr></output>

      蒲公英聯盟提供ghost win10,ghost win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

      當前位置:主頁 > 教程 > 服務器類 >

      ) 自定義認證類 在login app下創建auth.py文件

      來源:蒲公英系統┆發布時間:2018-10-31 05:07┆點擊:

      首先創建一個新的login app,用來存放認證用到代碼

      python manage.py startapp login

      修改settings.py中的認證項

      AUTHENTICATION_BACKENDS = ( 'login.auth.UsernamePasswordAuth', )

      自定義認證類

      在login app下創建auth.py文件,內容如下

      #coding:utf-8 from django.contrib.auth.models import User class UsernamePasswordAuth(object): def authenticate(self, username=None, password=None): print("UsernamePasswordAuth.authenticate") try: user = User.objects.get(username__iexact=username) if user.check_password(password): return user except User.DoesNotExist: return None def get_user(self, user_id): print("UsernamePasswordAuth.get_user") try: user = User.objects.get(pk=user_id) return user except User.DoesNotExist: return None

      尚未注冊暢言帳號,請到后臺注冊
      亚洲老妇人成熟女色,亚洲AV自慰白浆喷水网站,卡1卡2卡三卡2021精品
      <output id="11161"><video id="11161"></video></output>

      <code id="11161"></code>

      <cite id="11161"><video id="11161"></video></cite>

        <dd id="11161"><samp id="11161"><rp id="11161"></rp></samp></dd>
      1. <output id="11161"><tr id="11161"></tr></output>