Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jacotsu
uus
Commits
3278823f
Commit
3278823f
authored
Feb 06, 2019
by
JackV
Browse files
Switch from plain-text to crypt for password storage
parent
1266f0e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
uus.py
View file @
3278823f
...
...
@@ -4,6 +4,7 @@ from flask_redis import FlaskRedis
from
flask_httpauth
import
HTTPBasicAuth
import
re
import
os
import
crypt
app
=
flask
.
Flask
(
__name__
)
...
...
@@ -24,13 +25,14 @@ def handle_redirect(path):
return
flask
.
abort
(
404
)
@
auth
.
get_password
def
handle_login
(
username
):
password
=
redis_store
.
get
(
"user."
+
username
)
if
password
is
not
None
:
return
password
.
decode
()
@
auth
.
verify_password
def
handle_login
(
username
,
password
):
crypt_pw
=
redis_store
.
get
(
"user."
+
username
)
if
crypt_pw
is
not
None
:
crypt_pw
=
crypt_pw
.
decode
()
return
crypt_pw
==
crypt
.
crypt
(
password
,
crypt_pw
)
else
:
return
Non
e
return
Fals
e
@
app
.
route
(
'/admin'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment