欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

JD模擬用戶登錄(保持session)

# -*- coding:utf8 -*-
user_list=[
    {'name':'bobo','passwd':123},
    {'name':'zjy','passwd':123},
    {'name':'ld','passwd':123},
    {'name':'lzy','passwd':123},
    ]

current_user={'user':None,'login':False}
def auth_main(auth_type):
    def auth(func):
        def inner(*args,**kwargs):
            print('auth type是', auth_type)
            if auth_type=='filedb':
                if current_user['user'] and current_user['login']:
                    res=func(*args,**kwargs)
                    return res
                username=input('用戶名:').strip()
                passwd=int(input('密碼:').strip())
                for user_dic in user_list:
                    if username==user_dic['name'] and passwd==user_dic['passwd']:
                        current_user['user']=username
                        current_user['login']=True
                        res=func(*args,**kwargs)
                        return res
                else:
                    print('登錄失敗!用戶名或密碼錯誤!')
            elif auth_type=='ldap':
                print('LDAP')
            else:
                print('不知道是什么類型')
        return inner
    return auth
@auth_main('ddd')
def index():
    print('歡迎來到京東主頁!')
# @auth
# def home():
#     print('%s,歡迎來到您的主頁' %(current_user['user']))
# @auth
# def shop_car():
#     print('%s,您的購物車中有%s,%s,%s' %(current_user['user'],'IQOS','HEETS','中華'))

index()
# home()
# shop_car()

當前名稱:JD模擬用戶登錄(保持session)
文章網址:http://www.chinadenli.net/article22/joiocc.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供網站策劃動態(tài)網站微信公眾號Google網站導航軟件開發(fā)

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化