Setting global
This commit is contained in:
@@ -3,7 +3,7 @@ from flask import request, Response
|
||||
from functools import wraps
|
||||
|
||||
def check_auth(username, password):
|
||||
return username == Env.get('settings').get('username') and password == Env.get('settings').get('password')
|
||||
return username == Env.setting('username') and password == Env.setting('password')
|
||||
|
||||
def authenticate():
|
||||
return Response(
|
||||
@@ -16,7 +16,7 @@ def requires_auth(f):
|
||||
@wraps(f)
|
||||
def decorated(*args, **kwargs):
|
||||
auth = request.authorization
|
||||
if Env.get('settings').get('username') and (not auth or not check_auth(auth.username, auth.password)):
|
||||
if Env.setting('username') and (not auth or not check_auth(auth.username, auth.password)):
|
||||
return authenticate()
|
||||
|
||||
return f(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user