Esempio n. 1
0
def try_create_account(sock, name, psswd):
    if mudsys.account_exists(name):
        return False
    elif mudsys.account_creating(name):
        return False
    elif not check_acct_name(name):
        return False
    else:
        # creating a new account
        mud.log_string("Account '" + name + "' is trying to create.")

        # create our new account
        acct = mudsys.create_account(name)
        if acct == None:
            return False
        else:
            mudsys.attach_account_socket(acct, sock)
            mudsys.set_password(acct, psswd)
            sock.pop_ih()
            sock.push_ih(acct_menu_handler, acct_main_menu)

            #sock.push_ih(acct_finish_handler, acct_finish_prompt)

            # log that the account created
            mud.log_string("New account '" + acct.name + "' has created.")

            # register and save the account to disk
            mudsys.do_register(acct)

            return True
    return False
Esempio n. 2
0
def acct_new_password_handler(sock, arg):
    '''asks a new account for a password'''
    sock.send_raw(unsquelch)
    if len(arg) > 0:
        # put in mudsys to prevent scripts from messing with passwords
        mudsys.set_password(sock.account, arg)
        sock.pop_ih()