From 2f4a9865e175e3ce05d724b4b8ea1588cac80749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sat, 22 Feb 2020 17:49:33 +0100 Subject: [PATCH] Use absolute paths in the admin page --- src/api/admin.rs | 4 +++- src/static/templates/admin/base.hbs | 14 +++++++------- src/static/templates/admin/page.hbs | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/api/admin.rs b/src/api/admin.rs index b0c40b0c..937783f2 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -60,7 +60,7 @@ fn admin_path() -> String { fn admin_login(flash: Option) -> ApiResult> { // If there is an error, show it let msg = flash.map(|msg| format!("{}: {}", msg.name(), msg.msg())); - let json = json!({"page_content": "admin/login", "version": VERSION, "error": msg}); + let json = json!({"page_content": "admin/login", "version": VERSION, "error": msg, "urlpath": CONFIG.domain_path()}); // Return the page let text = CONFIG.render_template(BASE_TEMPLATE, &json)?; @@ -115,6 +115,7 @@ struct AdminTemplateData { config: Value, can_backup: bool, logged_in: bool, + urlpath: String, } impl AdminTemplateData { @@ -126,6 +127,7 @@ impl AdminTemplateData { config: CONFIG.prepare_json(), can_backup: *CAN_BACKUP, logged_in: true, + urlpath: CONFIG.domain_path(), } } diff --git a/src/static/templates/admin/base.hbs b/src/static/templates/admin/base.hbs index 9222a19c..e3948d06 100644 --- a/src/static/templates/admin/base.hbs +++ b/src/static/templates/admin/base.hbs @@ -6,10 +6,10 @@ Bitwarden_rs Admin Panel - - - - + + + +