P51用户认证cockie和session
http请求的特点:无状态、短链接
cookie:字典
1.保存在浏览器上的键值对
2.放松请求时,默认自动携带,浏览器安全设置可以关闭
session:保存在浏览器端
P51.基本实现
写好的登录框,以后可以直接套用
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录页面</title>
<link rel="stylesheet" href="{% static 'plugins/bootstrap-3.4.1-dist/css/bootstrap.min.css' %}">
<style>
.account {
width: 400px;
border: 1px solid #dddddd;
border-radius: 5px;
box-shadow: 5px 5px 20px #aaa;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
padding: 20px 40px;
}
.account h2 {
margin-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="account">
<h2>用户登录</h2>
<form>
<div class="form-group">
<label for="exampleInputEmail">用户名</label>
<input type="text" class="form-control" placeholder="用户名">
</div>
<div class="form-group">
<label>密码</label>
<input type="password" class="form-control" placeholder="密码">
</div>
<input type="submit" value="登 录" class="btn btn-primary">
</form>
</div>
</body>
</html>