def check_host(host): ''' Check we are running on the correct host see the notes about the use of flock(); and the affects of lockf(); ''' assert User.host() == host, "AberMUD is only available on {}, not on {}".format(host, User.host())
def login(username=None): ''' Does all the login stuff The whole login system is called from this ''' # Check if banned first b = User.chkbnid(User.host()) # cuserid(NULL)); logger.debug("BANNED %d", b) if username: username = username.lower() user = User.by_username(username) if user: authenticate(user) return user # Get the user name user = None while not user: user = input_username(username) username = '' if user.id: # Password checking authenticate(user) else: register(user) cls() return user