Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
kpt
2024-07-03 18:39:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86533a51a99b46cca74a7d21fdd4e65cf8b2cb3e
86533a51
1 parent
c3a95d74
【user.py】修复了哈希是全局变量的bug
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletions
views/user/user.py
views/user/user.py
View file @
86533a5
...
...
@@ -5,7 +5,6 @@ from flask import Blueprint, redirect, render_template, request, Flask, session
from
utils.query
import
query
from
utils.errorResponse
import
errorResponse
hash_with_salt
=
hashlib
.
sha256
(
'XiaoXueQi2024'
.
encode
(
'utf-8'
))
ub
=
Blueprint
(
'user'
,
__name__
,
url_prefix
=
'/user'
,
...
...
@@ -19,6 +18,7 @@ def login():
else
:
def
filter_fn
(
user
):
hash_with_salt
=
hashlib
.
sha256
(
'XiaoXueQi2024'
.
encode
(
'utf-8'
))
hash_with_salt
.
update
(
request
.
form
[
'password'
]
.
encode
(
'utf-8'
))
return
request
.
form
[
'username'
]
in
user
and
hash_with_salt
.
hexdigest
in
user
...
...
@@ -48,6 +48,7 @@ def register():
return
errorResponse
(
'该用户名已被注册'
)
else
:
time_tuple
=
time
.
localtime
(
time
.
time
())
hash_with_salt
=
hashlib
.
sha256
(
'XiaoXueQi2024'
.
encode
(
'utf-8'
))
hash_with_salt
.
update
(
request
.
form
[
'password'
]
.
encode
(
'utf-8'
))
query
(
'''
...
...
Please
register
or
login
to post a comment