mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-08 03:15:40 +00:00
Merge pull request #1027 from mirko/add-WWW-Authenticate-header-for-dyndns
dyndns: Respond with HTTP header 'WWW-Authenticate' to unauthed requests
This commit is contained in:
commit
33f1c6ad61
@ -1,7 +1,7 @@
|
|||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from flask import g, request, abort, current_app, render_template
|
from flask import g, request, abort, current_app, Response
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from .models import User, ApiKey, Setting, Domain, Setting
|
from .models import User, ApiKey, Setting, Domain, Setting
|
||||||
@ -409,7 +409,7 @@ def dyndns_login_required(f):
|
|||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
if current_user.is_authenticated is False:
|
if current_user.is_authenticated is False:
|
||||||
return render_template('dyndns.html', response='badauth'), 200
|
return Response(headers={'WWW-Authenticate': 'Basic'}, status=401)
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
|
|
||||||
return decorated_function
|
return decorated_function
|
||||||
|
Loading…
Reference in New Issue
Block a user