示例#1
0
def all_players():
    """ Displays the index page of the players submodule which lists all players. """

    user = web_token.jwt_cookie_to_user()
    players = db.all_users()
    resp = flask.make_response(flask.render_template('allPlayers.html', players=players, user=user))
    return resp
示例#2
0
def authenticate(email, password):
    valid_users = db.all_users()

    for user in valid_users:
        if email == user['email'] and user['password'] == password:
            return email
    return None
示例#3
0
def all_users():
    if hasattr(current_user, 'role'):
        role = current_user.get_role()
    else:
        role = ""

    return render_template('all-users.html', users=db.all_users(), role=role)
示例#4
0
def login_post():
    user = request.form.to_dict()
    db.insert_info(list(user.values()))
    print(list(user.values()))
    users = db.all_users()
    return render_template('list.html',
                           users=users)  #list.html 에 users라는 것을 넘길 것이다
示例#5
0
def api_user(name):
    users = db.all_users()
    user = [u for u in users if u['name'] == name]
    if len(user) == 1:
        return jsonify(user)
    else:
        response = jsonify({'message': "Invalid user " + name})
        response.status_code = 404
        return response
示例#6
0
def api_user(name):
    users = db.all_users()
    user = []
    for u in users:
        if u['userID'] == name:
            user.append(u)
    if len(user) == 1:
        return jsonify(user)
    else:
        response = jsonify({ 'message': "Invalid user "+name })
        response.status_code = 404
        return response
示例#7
0
def list_user():
    users = db.all_users()
    return render_template('list.html', users=users)
示例#8
0
def all_users():
    return render_template('all-users.html', users=db.all_users())
示例#9
0
def list_user():
    db.create_table()
    users=db.all_users()
    return render_template('list.html',users=users)
示例#10
0
def change_user():
    userName = input("Enter the username: "******"Enter the desired username: "******"Enter the desired password: "******"Enter the desired Full Name:")
    editUser(userName, userName2, password2, full_name2)

def remove_user():
    userName = input("Enter a username to be removed: ")
    deleteUser(userName)

val = 0
while val != "5":
    print("""please make a selection
    1 = List Users
    2 = Add User
    3 = Edit User
    4 = Delete User
    5 = Quit""")
    val = input("Enter Command:")
    if val == "1":
        all_users()
    elif val == "2":
        new_user()
    elif val == "3":
        change_user()
    elif val == "4":
        remove_user()


 def test_all_users(self):
     users = db.all_users()
     self.assertEqual(len(users), 0,
                      "All Users Day 0 - Unexpected extra users.")
 def test_all_users(self):
     users = db.all_users()
     self.assertEqual(
         len(users), 4,
         "All Users Day 1 - Unexpected number of users in day 1.")
示例#13
0
def api_users():
    users=db.all_users()
    return jsonify(users)