From 5bb7b73af39530163d3b75bee76b83c3a213c1a7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 5 Jul 2019 10:51:58 +0100 Subject: [PATCH] Comments --- auth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/auth.py b/auth.py index aa238f681..d5499dd2d 100644 --- a/auth.py +++ b/auth.py @@ -85,6 +85,8 @@ def authorizeBasic(baseDir: str,path: str,authHeader: str,debug: bool) -> bool: return False def storeBasicCredentials(baseDir: str,nickname: str,password: str) -> bool: + """Stores login credentials to a file + """ if ':' in nickname or ':' in password: return False nickname=nickname.replace('\n','').strip() @@ -115,6 +117,9 @@ def storeBasicCredentials(baseDir: str,nickname: str,password: str) -> bool: return True def removePassword(baseDir: str,nickname: str) -> None: + """Removes the password entry for the given nickname + This is called during account removal + """ passwordFile=baseDir+'/accounts/passwords' if os.path.isfile(passwordFile): with open(passwordFile, "r") as fin: @@ -125,6 +130,8 @@ def removePassword(baseDir: str,nickname: str) -> None: os.rename(passwordFile+'.new', passwordFile) def authorize(baseDir: str,path: str,authHeader: str,debug: bool) -> bool: + """Authorize using http header + """ if authHeader.lower().startswith('basic '): return authorizeBasic(baseDir,path,authHeader,debug) return False