Commit d2eeede9 authored by okhin's avatar okhin 🚴

Merge branch '6-fix-auth-for-admin' into 'master'

Creating a db initialisation for admin pages

Closes #6

See merge request !9
parents 2c29fb36 40ce9fa1
Pipeline #932 passed with stage
in 3 seconds
......@@ -481,14 +481,16 @@ def login_admin(user, password):
@app.get('/admin')
@auth_basic(login_admin)
def little_admin(db):
def little_admin():
db = sqlite3.connect(config['piphone']['db'])
# We need to check if we're admin
users = db.execute('SELECT api, token, admin FROM users').fetchall()
return template('index', users=users, token=request.params['token'])
@app.post('/admin')
@auth_basic(login_admin)
def medium_admin(db):
def medium_admin():
db = sqlite3.connect(config['piphone']['db'])
api = request.forms.get('api')
token = request.forms.get('api_token')
admin = request.forms.get('admin')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment