GraziePrego commited on
Commit
d701b42
·
verified ·
1 Parent(s): 36f9b5b

Upload helpers/login.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. helpers/login.py +15 -3
helpers/login.py CHANGED
@@ -1,3 +1,15 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ba5b0285306d55c51da3297634d216185d5f595bf3d27a15bbcb525b51e5ccfa
3
- size 408
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from helpers import dotenv
2
+ import hashlib
3
+
4
+
5
+ def get_credentials_hash():
6
+ user = dotenv.get_dotenv_value(dotenv.KEY_AUTH_LOGIN)
7
+ password = dotenv.get_dotenv_value(dotenv.KEY_AUTH_PASSWORD)
8
+ if not user:
9
+ return None
10
+ return hashlib.sha256(f"{user}:{password}".encode()).hexdigest()
11
+
12
+
13
+ def is_login_required():
14
+ user = dotenv.get_dotenv_value(dotenv.KEY_AUTH_LOGIN)
15
+ return bool(user)