0
0
Fork 0

Compare commits

...

2 Commits

5 changed files with 138 additions and 232 deletions

View File

@ -112,6 +112,13 @@ def reset():
# POST请求用于提交修改后信息
old_password = escape(request.form['old-password'])
new_password = escape(request.form['new-password'])
re_new_password = escape(request.form['re-new-password']) # 确认新密码
if re_new_password != new_password: #验证新密码两次输入是否相同
return '新密码不匹配,请重新输入'
if len(new_password) < 4: #验证新密码长度,原则参照注册模块
return '密码过于简单。(密码长度至少4位)'
flag = change_password(username, old_password, new_password) # flag表示是否修改成功
if flag:
session['logged_in'] = False

View File

@ -0,0 +1,107 @@
/*样式应用于login、signup、reset三个页面*/
.container {
background-color: #FFFFFF;
width: 400px;
height: 500px;
margin: 7em auto;
border-radius: 1.5em;
box-shadow: 0px 11px 35px 2px rgba(0, 0, 0, 0.14);
}
/*增加一个类reset-heading*/
.signin-heading, .reset-heading {
padding-top: 5px;
color: #8C55AA;
font-family: 'Ubuntu', sans-serif;
font-weight: bold;
font-size: 23px;
text-align: center;
}
/*增加2个类.old-password和.new-password*/
.username, .email, .password, .re-password, .old-password, .new-password,.re-new-password {
width: 76%;
color: rgb(38, 50, 56);
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
background: rgba(136, 126, 126, 0.04);
padding: 10px 20px;
border: none;
border-radius: 20px;
outline: none;
box-sizing: border-box;
border: 2px solid rgba(124, 16, 97, 0.02);
margin-bottom: 50px;
margin-left: 46px;
text-align: center;
margin-bottom: 27px;
font-family: 'Ubuntu', sans-serif;
}
.btn {
width: 50%;
border: none;
border-radius: 20px;
box-sizing: border-box;
border: 2px solid #8C55AA;
margin-bottom: 50px;
margin-left: 90px;
padding: 10px 20px;
}
.btn:hover {
background: #8C55AA;
transition: .5s;
cursor: pointer;
color: #fff;
}
.signup {
display: flex;
justify-content: center;
align-items: center;
}
ul {
position: absolute;
display: flex;
left: 65%;
}
li {
padding: 10px;
margin: 10px;
}
a {
text-decoration: none;
list-style: none;
font-weight: bold;
font-family: 'ink free';
}
.main_menu a {
color: #fff;
font-size: 300px;
}
li :hover {
color: #8C55AA;
transition: .5s;
}
h1 {
font-family: 'ink free';
}
.main_menu h1 {
color: #fff;
}

View File

@ -5,115 +5,7 @@ You're logged in already!
{% else %}
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" />
<style>
.container{
background-color: #FFFFFF;
width: 400px;
height: 500px;
margin: 7em auto;
border-radius: 1.5em;
box-shadow: 0px 11px 35px 2px rgba(0, 0, 0, 0.14);
}
.signin-heading{
padding-top: 5px;
color: #8C55AA;
font-family: 'Ubuntu', sans-serif;
font-weight: bold;
font-size: 23px;
text-align: center;
}
.username, .email, .password, .re-password{
width: 76%;
color: rgb(38, 50, 56);
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
background: rgba(136, 126, 126, 0.04);
padding: 10px 20px;
border: none;
border-radius: 20px;
outline: none;
box-sizing: border-box;
border: 2px solid rgba(124, 16, 97, 0.02);
margin-bottom: 50px;
margin-left: 46px;
text-align: center;
margin-bottom: 27px;
font-family: 'Ubuntu', sans-serif;
}
.btn{
width: 50%;
border: none;
border-radius: 20px;
box-sizing: border-box;
border: 2px solid #8C55AA;
margin-bottom: 50px;
margin-left: 90px;
padding: 10px 20px;
}
.btn:hover{
background: #8C55AA;
transition: .5s;
cursor: pointer;
color: #fff;
}
.signup{
display: flex;
justify-content: center;
align-items: center;
}
ul{
position: absolute;
display: flex;
left: 65%;
}
li{
padding: 10px;
margin: 10px;
}
a{
text-decoration: none;
list-style: none;
font-weight: bold;
font-family: 'ink free';
}
.main_menu a{
color: #fff;
font-size: 300;
}
li :hover{
color: #8C55AA;
transition: .5s;
}
h1{
font-family: 'ink free';
}
.main_menu h1{
color: #fff;
}
</style>
<link rel="stylesheet" href="static/css/login_service.css">
<div class="container">

View File

@ -1,14 +1,22 @@
<html>
<body>
<form action="/reset" method='POST'>
旧密码:
<input type="password" name="old-password" />
<br/>
新密码:
<input type="password" name="new-password" />
<br/>
<input type="submit" name="submit" value="提交" />
<input type="button" name="submit" value="放弃修改" onclick="window.location.href='/{{ username }}'"/>
</form>
</body>
</html>
{% block body %}
<meta charset="utf-8" name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes"/>
<link rel="stylesheet" href="static/css/login_service.css">
<div class="container">
<section class="reset-heading">
<h1>Reset Password</h1>
</section>
<form action="/reset" method="POST">
<input type="password" placeholder="原密码" class="old-password" name="old-password" required>
<input type="password" placeholder="新密码" class="new-password" name="new-password" required>
<input type="password" placeholder="确认新密码" class="re-new-password" name="re-new-password" required>
<input type="submit" name="submit" class="btn" value="提交"/>
<input type="button" name="submit" class="btn" value="放弃修改"
onclick="window.location.href='/{{ username }}'"/>
</form>
</div>
{% endblock %}

View File

@ -5,117 +5,9 @@ You're logged in already! <a href="/logout">Logout</a>.
{% else %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" />
<link rel="stylesheet" href="static/css/login_service.css">
<p>{{ get_flashed_messages()[0] | safe }}</p>
<style>
.container{
background-color: #FFFFFF;
width: 400px;
height: 500px;
margin: 7em auto;
border-radius: 1.5em;
box-shadow: 0px 11px 35px 2px rgba(0, 0, 0, 0.14);
}
.signin-heading{
padding-top: 5px;
color: #8C55AA;
font-family: 'Ubuntu', sans-serif;
font-weight: bold;
font-size: 23px;
text-align: center;
}
.username,.password, .re-password{
width: 76%;
color: rgb(38, 50, 56);
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
background: rgba(136, 126, 126, 0.04);
padding: 10px 20px;
border: none;
border-radius: 20px;
outline: none;
box-sizing: border-box;
border: 2px solid rgba(124, 16, 97, 0.02);
margin-bottom: 50px;
margin-left: 46px;
text-align: center;
margin-bottom: 27px;
font-family: 'Ubuntu', sans-serif;
}
.btn{
width: 50%;
border: none;
border-radius: 20px;
box-sizing: border-box;
border: 2px solid #8C55AA;
margin-bottom: 50px;
margin-left: 90px;
padding: 10px 20px;
}
.btn:hover{
background: #8C55AA;
transition: .5s;
cursor: pointer;
color: #fff;
}
.signup{
display: flex;
justify-content: center;
align-items: center;
}
ul{
position: absolute;
display: flex;
left: 65%;
}
li{
padding: 10px;
margin: 10px;
}
a{
text-decoration: none;
list-style: none;
font-weight: bold;
font-family: 'ink free';
}
.main_menu a{
color: #fff;
font-size: 300;
}
li :hover{
color: #8C55AA;
transition: .5s;
}
h1{
font-family: 'ink free';
}
.main_menu h1{
color: #fff;
}
</style>
<div class="container">