conform to public_endpoint config option with internal local host fallback
This commit is contained in:
parent
af023741d9
commit
96575323cd
@ -994,7 +994,7 @@ class API(object):
|
|||||||
get_current_url(env, strip_querystring=True) + '/index.html'
|
get_current_url(env, strip_querystring=True) + '/index.html'
|
||||||
)
|
)
|
||||||
|
|
||||||
def login(self, env, req):
|
def login(self, env, req):
|
||||||
data = req.form
|
data = req.form
|
||||||
password = self.isso.conf.get("general", "admin_password")
|
password = self.isso.conf.get("general", "admin_password")
|
||||||
if data['password'] and data['password'] == password:
|
if data['password'] and data['password'] == password:
|
||||||
@ -1010,16 +1010,18 @@ class API(object):
|
|||||||
response.headers.add("X-Set-Cookie", cookie("isso-admin-session"))
|
response.headers.add("X-Set-Cookie", cookie("isso-admin-session"))
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
return render_template('login.html', isso_host_script=local.host)
|
isso_host_script = self.isso.conf.get("server", "public-endpoint") or local.host
|
||||||
|
return render_template('login.html', isso_host_script=isso_host_script)
|
||||||
|
|
||||||
def admin(self, env, req):
|
def admin(self, env, req):
|
||||||
|
isso_host_script = self.isso.conf.get("server", "public-endpoint") or local.host
|
||||||
try:
|
try:
|
||||||
data = self.isso.unsign(req.cookies.get('admin-session', ''),
|
data = self.isso.unsign(req.cookies.get('admin-session', ''),
|
||||||
max_age=60 * 60 * 24)
|
max_age=60 * 60 * 24)
|
||||||
except BadSignature:
|
except BadSignature:
|
||||||
return render_template('login.html',isso_host_script=local.host)
|
return render_template('login.html',isso_host_script=isso_host_script)
|
||||||
if not data or not data['logged']:
|
if not data or not data['logged']:
|
||||||
return render_template('login.html',isso_host_script=local.host)
|
return render_template('login.html',isso_host_script=isso_host_script)
|
||||||
page_size = 100
|
page_size = 100
|
||||||
page = int(req.args.get('page', 0))
|
page = int(req.args.get('page', 0))
|
||||||
order_by = req.args.get('order_by', None)
|
order_by = req.args.get('order_by', None)
|
||||||
@ -1040,4 +1042,4 @@ class API(object):
|
|||||||
conf=self.conf, max_page=max_page,
|
conf=self.conf, max_page=max_page,
|
||||||
counts=comment_mode_count,
|
counts=comment_mode_count,
|
||||||
order_by=order_by, asc=asc,
|
order_by=order_by, asc=asc,
|
||||||
isso_host_script=local.host)
|
isso_host_script=isso_host_script)
|
||||||
|
Loading…
Reference in New Issue
Block a user