def onSetMaster(cn, givenhash): p = player(cn) adminhash = sauerbomber.hashPassword(cn, sauerbomber.adminPassword()) try: na = dbmanager.query(NickAccount).filter(NickAccount.nick==p.name()).one() except NoResultFound: if givenhash != adminhash: p.message(error('Your name is not assigned to any accounts')) except MultipleResultsFound: p.message(error('Multiple names linked to this account. Contact the system administrator.')) else: nickhash = sauerbomber.hashPassword(cn, na.user.password) if givenhash == nickhash: login(cn, na.user) else: if givenhash != adminhash: p.message(error('Invalid password'))
def onSetMaster(cn, hash): if hash == sauerbomber.hashPassword(cn, sauerbomber.adminPassword()): sauerbomber.setAdmin(cn)