diff --git a/app/account_service.py b/app/account_service.py index 09439d5..dc854a3 100644 --- a/app/account_service.py +++ b/app/account_service.py @@ -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 diff --git a/app/static/css/login_service.css b/app/static/css/login_service.css new file mode 100644 index 0000000..50277e6 --- /dev/null +++ b/app/static/css/login_service.css @@ -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; +} \ No newline at end of file diff --git a/app/templates/login.html b/app/templates/login.html index e3e19d1..a347e22 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -5,115 +5,7 @@ You're logged in already! {% else %} - +
diff --git a/app/templates/reset.html b/app/templates/reset.html index b26de3c..902d046 100644 --- a/app/templates/reset.html +++ b/app/templates/reset.html @@ -1,14 +1,22 @@ - - -
- 旧密码: - -
- 新密码: - -
- - -
- - \ No newline at end of file +{% block body %} + + + +
+ +
+

Reset Password

+
+ +
+ + + + + +
+ +
+{% endblock %} \ No newline at end of file diff --git a/app/templates/signup.html b/app/templates/signup.html index bbc653a..f7bd69f 100644 --- a/app/templates/signup.html +++ b/app/templates/signup.html @@ -5,117 +5,9 @@ You're logged in already! Logout. {% else %} +

{{ get_flashed_messages()[0] | safe }}

-