16 lines
539 B
Python
16 lines
539 B
Python
global userPath
|
|
userPath = p(sp,"users")
|
|
|
|
global configparser
|
|
import configparser
|
|
|
|
global authenticate
|
|
def authenticate(user,passw):
|
|
fpath = p(userPath,user.replace("/","").replace("\\","").replace("..","") + ".ini")
|
|
if not os.path.isfile(fpath): return
|
|
config = configparser.ConfigParser()
|
|
with fileLock: config.read(fpath)
|
|
if not "DEFAULT" in config: config["DEFAULT"] = {}
|
|
if not config["DEFAULT"]["password"]: config["DEFAULT"]["password"] = ""
|
|
if passw != config["DEFAULT"]["password"]: return False
|
|
return True |