def login(caller,*params): username=None password=None if UserSessionManager[caller][0]!="notloggedin": username=UserSessionManager[caller][0] logout(caller) #extract username and password if len(params)==2: username=params[0] password=params[1] elif len(params)==1: password=params[0] #guess username if username is None: if caller[0]=="irc": user=userdatabase.search("irc nick",formatCaller(caller)) elif caller[0]=="ingame": user=userdatabase.search("sauerbraten name",formatCaller(caller)) else: raise ValueError("Could not determine your login name.") if user is None: raise ValueError("Could not determine your login name. Use \"@login username password\" to specify.") else: user=userdatabase[username] #temporarly cache the user instance user=dict(user.items()) #authenticate with everything's that's available if password is None: if caller[0]=="irc": #call an ident message, TODO pass if caller[0]=="ingame": #this can only be verified with auth, and that's user initiated pass else: #hostname based pass else: if user["password"]==password: succeedLogin(caller,user) return raise PermissionError("Denied to login.")
def authLogin(caller,authname): user=userdatabase.search("auth name",authname) if user is not None: succeedLogin(caller,dict(user.items())) else: if(config["authgainmaster"]=="yes"): setSimpleMaster(caller)
def authLogin(caller,authname): user=userdatabase.search("auth name",authname) if user is not None: succeedLogin(caller,dict(user.items())) else: if(config["authgainmaster"]=="yes"): systemCS.executestring("takemaster") #logout all other tiny masters setSimpleMaster(caller)
def login(caller,*params): """This allows the caller to login to the server giving them the permission level that is allocated to them by the database.""" username=None password=None if UserSessionManager[caller][0]!="notloggedin": username=UserSessionManager[caller][0] logout(caller) #extract username and password if len(params)==2: username=params[0] password=params[1] elif len(params)==1: password=params[0] #guess username if username is None: if caller[0]=="irc": user=userdatabase.search("irc nick",formatCaller(caller)) elif caller[0]=="ingame": user=userdatabase.search("sauerbraten name",formatCaller(caller)) else: raise ValueError("Could not determine your login name.") if user is None: raise ValueError("Could not determine your login name. Use \"@login username password\" to specify.") else: user=userdatabase[username] #temporarly cache the user instance userInterface=user user=dict(user.items()) #authenticate with everything's that's available if password is None: if caller[0]=="irc": #call an ident message, TODO pass #check hostname TODO else: if hashPassword(password) in userInterface["password"]: succeedLogin(caller,user) return raise PermissionError("Denied to login.")