Hfzune commited on
Commit
02bf3fb
·
verified ·
1 Parent(s): 0243ba0

Create admin/auth.py

Browse files
Files changed (1) hide show
  1. admin/auth.py +11 -0
admin/auth.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+
3
+ log = logging.getLogger("admin.auth")
4
+
5
+
6
+ def check_admin_password(supplied: str, expected: str) -> bool:
7
+ if not supplied or not expected:
8
+ return False
9
+ # constant-time compare
10
+ import hmac
11
+ return hmac.compare_digest(supplied, expected)