当前位置: 首页>>代码示例>>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;未经允许,请勿转载。