开始处理注册功能

This commit is contained in:
yangjian 2019-07-24 18:09:18 +08:00
parent fd0f2737e8
commit 2f466673f5
5 changed files with 67 additions and 6 deletions

View File

@ -45,7 +45,11 @@ def log_in(request):
# 注册视图
def register(request):
pass
if request.user.is_authenticated:
return redirect('/')
else:
if request.method == 'GET':
return render(request,'register.html',locals())
# 注销
def log_out(request):

View File

@ -11,6 +11,7 @@ def project_list(request):
project_list = Project.objects.all()
return render(request, 'app_doc/pro_list.html', locals())
# 创建文集
@login_required()
def create_project(request):
@ -92,6 +93,7 @@ def del_project(request):
else:
return JsonResponse({'status':False,'data':'参数错误'})
# 管理文集
@login_required()
def manage_project(request):

Binary file not shown.

View File

@ -38,7 +38,7 @@
</a>
<dl class="layui-nav-child">
<!-- <dd><a href="">基本资料</a></dd> -->
<dd><a href="javascript:void(0);">注册</a></dd>
<dd><a href="{% url 'register' %}">注册</a></dd>
<dd><a href="{% url 'login' %}">登录</a></dd>
</dl>
</li>

View File

@ -1,10 +1,65 @@
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<html lang='zh-CN'>
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>用户注册 - MrDoc</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}" crossorigin="anonymous">
<style>
body{
background-color: #fafafa;
text-align: center;
}
.container{
display: flex;
display: -webkit-flex;
justify-content: center;
align-items: center;
}
.login-form{
margin-top: 15%;
{#width: 400px;#}
padding: 20px 50px 20px 60px;
background-color: #fff;
-webkit-box-shadow: #666 0px 0px 10px;
-moz-box-shadow: #666 0px 0px 10px;
box-shadow: #666 0px 0px 10px;
}
.register-link{
font-size: 12px;
}
</style>
</head>
<body>
<div class="container">
<div></div>
<div></div>
<div class="login-form">
<form class="layui-form" action="{% url 'login' %}" method='POST'>
{% csrf_token %}
<div class="layui-form-item">
<h2><strong>注册 - MrDoc</strong></h2>
</div>
<span style='color:red;margin-bottom: 10px;'>{{ errormsg }}</span>
<div class="layui-form-item">
<div class="layui-input-inline">
<input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline">
<input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-inline">
<button class="layui-btn layui-btn-fluid layui-btn-radius layui-btn-normal" lay-submit lay-filter="formDemo" type="submit">登录</button>
</div>
</div>
<a href="{% url 'register' %}" class="register-link">注册新账号</a>
</form>
</div>
</div>
</body>
</html>