Skip to content

Commit

Permalink
优化BasicAuth响应头信息
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Jul 3, 2019
1 parent 9993886 commit 13095d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion BTPanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import common,db,jobs,uuid
jobs.control_init()
app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
local_ip = None


try:
Expand Down Expand Up @@ -99,7 +100,9 @@ def basic_auth_check():


def send_authenticated():
return Response('', 401,{'WWW-Authenticate': 'Basic realm="Login Required"'})
global local_ip
if not local_ip: local_ip = public.GetLocalIp()
return Response('', 401,{'WWW-Authenticate': 'Basic realm="%s"' % local_ip})

@app.route('/',methods=method_all)
def home():
Expand Down

0 comments on commit 13095d6

Please sign in to comment.