示例#1
0
def adminlogin():
    if request.method == 'GET':
        return render_template('adminlogin.html')
    elif request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        adminkey = request.form['adminkey']
        d = Data()
        users = d.users()
        holdings = d.holdings()
        orders = d.orders()
        leaderboard = d.leaderboard()
        u = User(username)
        if u.admin(password, adminkey):
            return render_template('admindashboard.html',
                                   users=users,
                                   holdings=holdings,
                                   orders=orders,
                                   leaderboard=leaderboard)
        else:
            return render_template('adminlogin.html')
示例#2
0
def superuser():
    if request.method == 'GET':
        return render_template('secretlogin.html')
    elif request.method == 'POST':
        username = request.form['username']
        password = request.form['password']
        superkey = request.form['superkey']
        d = Data()
        users = d.users()
        holdings = d.holdings()
        orders = d.orders()
        leaderboard = d.leaderboard()
        super_balance = 10000000000000
        u = User(username)
        if u.superuser(password, superkey):
            return render_template('superuser.html',
                                   users=users,
                                   holdings=holdings,
                                   orders=orders,
                                   leaderboard=leaderboard,
                                   super_balance=super_balance)
        else:
            return render_template('secretlogin.html')