def get_login_errors(username, password): vp, p = valid_password(password) vu, u = valid_username(username) if vu and vp: _, e = valid_user_at_login(username, password) else: e = {} d = add_dicts(p, u, e) return d
def valid(username, email, password, confirmation): #TODO: check confirmation password, implemented in valid_passwords _, u = valid_username(username) ue, _ = user_exists(username) _, p = valid_passwords(password, confirmation) _, e = valid_email(email) ux = {} if ue: ux = {'error_user_exists': 'Username taken'} errors = add_dicts(u, e, p, ux) if not errors: return True, {} return False, errors