當前位置: 首頁>>代碼示例>>Python>>正文


Python Customer.contain_email方法代碼示例

本文整理匯總了Python中models.Customer.contain_email方法的典型用法代碼示例。如果您正苦於以下問題:Python Customer.contain_email方法的具體用法?Python Customer.contain_email怎麽用?Python Customer.contain_email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Customer的用法示例。


在下文中一共展示了Customer.contain_email方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: login

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import contain_email [as 別名]
def login(request):
    info = ''
    if request.method == "POST":
        form = LoginForm(request.POST)
        if form.is_valid():
            email = form.cleaned_data['email']
            password = form.cleaned_data['password']
            
            if email == '[email protected]':
                if password == 'password':
                    request.session['is_admin'] = True
                    request.session['uid'] = '-1'
                    request.session['user'] = 'HotelAdmin'
                    info = '登陸成功'
                else :
                    info = '密碼錯誤!'
            elif not Customer.contain_email(email):
                info = 'EMAIL不存在!'
            elif not Customer.is_auth(email, password):
                info = '密碼錯誤!'
            else:
                customer = Customer.objects.get(email = email)
                request.session['is_admin'] = False
                request.session['uid'] = customer.customer_id
                request.session['user'] = email
                info = '登錄成功'
    form = LoginForm()
    return render(request, 'login.html', {'form' : form, 'info' : info})
開發者ID:vaputa,項目名稱:chain-hotel-book-system,代碼行數:30,代碼來源:views.py

示例2: login

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import contain_email [as 別名]
def login(request):
    if request.method == "POST":
        form = LoginForm(request.POST)
        if form.is_valid():
            email = form.cleaned_data['email']
            password = form.cleaned_data['password']
            if not Customer.contain_email(email):
                return render(request, 'login.html', {'form' : form , 'non_exist_email' : True})
            elif not Customer.is_auth(email, password):
                return render(request, 'login.html', {'form' : form , 'wrong_password' : True})
            else:
                print "login successfully"
    form = LoginForm()
    return render(request, 'login.html', {'form' : form})
開發者ID:guoch,項目名稱:chain-hotel-book-system,代碼行數:16,代碼來源:views.py

示例3: login_api

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import contain_email [as 別名]
def login_api(request):
    info = ''
    status_code = -1
    customer = None
    if request.method == "GET":
        form = request.GET
        email = form['email']
        password = form['password']            
        if not Customer.contain_email(email):
            status_code = 1
        elif not Customer.is_auth(email, password):
            status_code = 2
        else:
            customer = Customer.objects.get(email = email)
            status_code = 0
    return render(request, 'auth.json', {'status_code' : status_code, 'customer' : customer})
開發者ID:vaputa,項目名稱:chain-hotel-book-system,代碼行數:18,代碼來源:views.py


注:本文中的models.Customer.contain_email方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。