예제 #1
0
def acct_password_handler(sock, arg):
    '''asks an account to verify its password'''
    # password functions put in mudsys to prevent scripts from
    # messing with passwords
    sock.send_raw(unsquelch)
    if not mudsys.password_matches(sock.account, arg):
        sock.send("Incorrect password.")
        sock.close()
    else:
        # password matches, pop our handler and go down a level
        sock.pop_ih()
예제 #2
0
def try_load_account(sock, name, psswd):
    '''Attempt to load an account with the given name and password.'''
    if not mudsys.account_exists(name):
        return False
    else:
        acct = mudsys.load_account(name)
        if not mudsys.password_matches(acct, psswd):
            return False

        # successful load
        mudsys.attach_account_socket(acct, sock)
        sock.pop_ih()
        sock.push_ih(acct_menu_handler, acct_main_menu)
        return True
    return False