Exemple #1
0
def update_acc_details(client_obj, unique_id):
    result, acc_details = db.get_user_acc_details(client_obj.acc_details,
                                                  unique_id)
    if (result == GeneralResult.SUCCESS):
        client_obj.acc_details = acc_details
        debug.log_accounts(
            "updated account details: id: %d, user: %s, gold: %d" %
            (acc_details.unique_id, acc_details.username, acc_details.gold))
Exemple #2
0
def update_acc_details(client_obj, unique_id):
    result, acc_details = db.get_user_acc_details(client_obj.acc_details, unique_id);
    if (result == GeneralResult.SUCCESS):
        client_obj.acc_details = acc_details;
        debug.log_accounts("updated account details: id: %d, user: %s, gold: %d" %
                           (acc_details.unique_id, acc_details.username, acc_details.gold));
Exemple #3
0
def format_user_pass(username, password):
    if (username.__len__() < MIN_USERNAME_LEN):
        debug.log_accounts("could not format username (%s) - it is too short" %
                           (username))
        return "", "", False
    elif (password.__len__() < MIN_PASSWORD_LEN):
        debug.log_accounts("could not format password (%s) - it is too short" %
                           (password))
        return "", "", False
    elif (username.__len__() > MAX_USERNAME_LEN):
        debug.log_accounts(
            "could not format username (%s...) - it is too long" %
            (username[0:accounts.MAX_USERNAME_LEN]))
        return "", "", False
    elif (password.__len__() > MAX_PASSWORD_LEN):
        debug.log_accounts(
            "could not format password (%s...) - it is too long" %
            (password[0:accounts.MAX_USERNAME_LEN]))
        return "", "", False
    elif not (re.search(input_regex, username)):
        debug.log_accounts(
            "could not format username - contains invalid characters")
        return "", "", False
    elif not (re.search(input_regex, password)):
        debug.log_accounts(
            "could not format password - contains invalid characters")
        return "", "", False

    password = hashlib.sha256(password).hexdigest()

    err = True
    return username, password, err
Exemple #4
0
def format_user_pass(username, password):
    if (username.__len__() < MIN_USERNAME_LEN):
        debug.log_accounts("could not format username (%s) - it is too short" % (username));
        return "", "", False;
    elif (password.__len__() < MIN_PASSWORD_LEN):
        debug.log_accounts("could not format password (%s) - it is too short" % (password));
        return "", "", False;
    elif (username.__len__() > MAX_USERNAME_LEN):
        debug.log_accounts("could not format username (%s...) - it is too long" % (username[0:accounts.MAX_USERNAME_LEN]));
        return "", "", False;
    elif (password.__len__() > MAX_PASSWORD_LEN):
        debug.log_accounts("could not format password (%s...) - it is too long" % (password[0:accounts.MAX_USERNAME_LEN]));
        return "", "", False;
    elif not (re.search(input_regex, username)):
        debug.log_accounts("could not format username - contains invalid characters");
        return "", "", False;
    elif not (re.search(input_regex, password)):
        debug.log_accounts("could not format password - contains invalid characters");
        return "", "", False;

    password = hashlib.sha256(password).hexdigest();

    err = True;
    return username, password, err;