You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
930 B

from django.http import HttpResponse
3 years ago
from django.shortcuts import render
from apps.account.models import Account
3 years ago
# Create your views here.
def login(request):
#
return render(request, "login1.html")
def submit(request):
if request.method == 'POST':
# 从前端数据中拿去表中字段
user_name = request.POST.get('email')
user_password = request.POST.get('password')
# user_password_confirm = request.POST.get('user_password_confirm')
# 根据用户名查询数据库,并获得用户
user_obj = Account.objects.filter(user_name=user_name).first()
if user_obj.user_name == user_name and user_obj.user_password == user_password and user_obj.user_password_confirm == user_password_confirm:
return HttpResponse("登录成功")
else:
return HttpResponse("登录失败")
else:
return HttpResponse("登录失败")