aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins/basic_auth/tools.py
diff options
context:
space:
mode:
authorBen Sturmfels <ben@sturm.com.au>2021-03-05 23:12:19 +1100
committerBen Sturmfels <ben@sturm.com.au>2021-03-05 23:12:19 +1100
commitdec47c7102cf0aa3a4debf002928db8e460c0d71 (patch)
tree47631fc15c7af172aa699506adf3d76d3a71976c /mediagoblin/plugins/basic_auth/tools.py
parent5f3a782fef4855e10b7259624a14d8afb0f7be93 (diff)
downloadmediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.lz
mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.xz
mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.zip
Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.
Diffstat (limited to 'mediagoblin/plugins/basic_auth/tools.py')
-rw-r--r--mediagoblin/plugins/basic_auth/tools.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/plugins/basic_auth/tools.py b/mediagoblin/plugins/basic_auth/tools.py
index 13f240b2..ad3cb1b0 100644
--- a/mediagoblin/plugins/basic_auth/tools.py
+++ b/mediagoblin/plugins/basic_auth/tools.py
@@ -40,7 +40,7 @@ def bcrypt_check_password(raw_pass, stored_hash, extra_salt=None):
True or False depending on success.
"""
if extra_salt:
- raw_pass = u"%s:%s" % (extra_salt, raw_pass)
+ raw_pass = "{}:{}".format(extra_salt, raw_pass)
hashed_pass = bcrypt.hashpw(raw_pass.encode('utf-8'), stored_hash)
@@ -66,9 +66,9 @@ def bcrypt_gen_password_hash(raw_pass, extra_salt=None):
non-database extra salt
"""
if extra_salt:
- raw_pass = u"%s:%s" % (extra_salt, raw_pass)
+ raw_pass = "{}:{}".format(extra_salt, raw_pass)
- return six.text_type(
+ return str(
bcrypt.hashpw(raw_pass.encode('utf-8'), bcrypt.gensalt()))
@@ -92,8 +92,8 @@ def fake_login_attempt():
EMAIL_FP_VERIFICATION_TEMPLATE = (
- u"{uri}?"
- u"token={fp_verification_key}")
+ "{uri}?"
+ "token={fp_verification_key}")
def send_fp_verification_email(user, request):