From 3e0b6d908a6920159dffd0b43d3d1f401ca8ae71 Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 17 Nov 2021 11:39:09 +0200 Subject: [PATCH 1/4] fix auth routes --- peach-web/src/routes/authentication.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/peach-web/src/routes/authentication.rs b/peach-web/src/routes/authentication.rs index 1d1a9b6..27c7cb3 100644 --- a/peach-web/src/routes/authentication.rs +++ b/peach-web/src/routes/authentication.rs @@ -206,7 +206,6 @@ pub fn save_reset_password_form(password_form: ResetPasswordForm) -> Result<(), /// Password reset request handler. This route is used by a user who is not logged in /// and is specifically for users who have forgotten their password. -/// All routes under /public/* are excluded from nginx basic auth via the nginx config. #[get("/reset_password")] pub fn reset_password(flash: Option) -> Template { let mut context = ResetPasswordContext::build(); @@ -223,7 +222,6 @@ pub fn reset_password(flash: Option) -> Template { /// Password reset form request handler. This route is used by a user who is not logged in /// and is specifically for users who have forgotten their password. -/// This route is excluded from nginx basic auth via the nginx config. #[post("/reset_password", data = "")] pub fn reset_password_post(reset_password_form: Form) -> Template { let result = save_reset_password_form(reset_password_form.into_inner()); @@ -366,7 +364,7 @@ pub fn save_password_form(password_form: PasswordForm) -> Result<(), PeachWebErr pub fn change_password(flash: Option, _auth: Authenticated) -> Template { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/settings/admin".to_string()); + context.back = Some("/network".to_string()); context.title = Some("Change Password".to_string()); // check to see if there is a flash message to display if let Some(flash) = flash { @@ -385,7 +383,7 @@ pub fn change_password_post(password_form: Form, _auth: Authentica Ok(_) => { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/settings/admin".to_string()); + context.back = Some("/network".to_string()); context.title = Some("Change Password".to_string()); context.flash_name = Some("success".to_string()); context.flash_msg = Some("New password is now saved".to_string()); @@ -395,7 +393,7 @@ pub fn change_password_post(password_form: Form, _auth: Authentica Err(err) => { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/settings/admin".to_string()); + context.back = Some("/network".to_string()); context.title = Some("Configure DNS".to_string()); context.flash_name = Some("error".to_string()); context.flash_msg = Some(format!("Failed to save new password: {}", err)); From d0ae5d2966b6d877d7666d3f990dd49679d96f8c Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 17 Nov 2021 11:39:29 +0200 Subject: [PATCH 2/4] update admin setting template paths --- peach-web/templates/settings/admin/change_password.html.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peach-web/templates/settings/admin/change_password.html.tera b/peach-web/templates/settings/admin/change_password.html.tera index f4414a6..bbe73b5 100644 --- a/peach-web/templates/settings/admin/change_password.html.tera +++ b/peach-web/templates/settings/admin/change_password.html.tera @@ -34,7 +34,7 @@
- Cancel + Cancel From 0b2b346bfc891adc51090379a570ef76bec9e324 Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 17 Nov 2021 11:40:02 +0200 Subject: [PATCH 3/4] add test and reorder existing tests --- peach-web/src/tests.rs | 521 +++++++++++++++++++++++++++-------------- 1 file changed, 340 insertions(+), 181 deletions(-) diff --git a/peach-web/src/tests.rs b/peach-web/src/tests.rs index 18365cc..712fa38 100644 --- a/peach-web/src/tests.rs +++ b/peach-web/src/tests.rs @@ -52,6 +52,260 @@ fn index_html() { assert!(body.contains("/settings")); } +#[test] +fn help_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/help").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Help")); +} + +#[test] +fn login_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/login").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Login")); +} + +#[test] +fn logout_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/logout").dispatch(); + // check for 303 status (redirect to "/login") + assert_eq!(response.status(), Status::SeeOther); + assert_eq!(response.content_type(), None); +} + +#[test] +fn power_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/power").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Shutdown Device")); +} + +/* + +NOTE: these tests are comment-out for the moment, due to the fact that they invoke system commands (resulting in a `sudo` password request during test execution). see if we can find a way to test the results without triggering the shutdown or restart. + +#[test] +fn reboot() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/power/reboot").dispatch(); + // check for redirect + assert_eq!(response.status(), Status::SeeOther); +} + +#[test] +fn shutdown() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/power/shutdown").dispatch(); + // check for redirect + assert_eq!(response.status(), Status::SeeOther); +} +*/ + +// SCUTTLEBUTT ROUTES + +#[test] +fn block() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client + .post("/scuttlebutt/block") + .header(ContentType::Form) + .body("key=HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") + .dispatch(); + assert_eq!(response.status(), Status::SeeOther); +} + +#[test] +fn blocks_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/blocks").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Blocks")); +} + +#[test] +fn follow() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client + .post("/scuttlebutt/follow") + .header(ContentType::Form) + .body("key=@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") + .dispatch(); + // ensure we redirect (303) + assert_eq!(response.status(), Status::SeeOther); +} + +#[test] +fn follows_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/follows").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Follows")); +} + +#[test] +fn followers_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/followers").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Followers")); +} + +#[test] +fn friends_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/friends").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Friends")); +} + +#[test] +fn peers_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/peers").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Scuttlebutt Peers")); +} + +#[test] +fn private_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/private").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Private Messages")); +} + +#[test] +fn profile_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/scuttlebutt/profile").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Profile")); +} + +#[test] +fn publish_post() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client + .post("/scuttlebutt/publish") + .header(ContentType::Form) + .body("text='golden ripples in the meshwork'") + .dispatch(); + assert_eq!(response.status(), Status::SeeOther); +} + +#[test] +fn unfollow() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client + .post("/scuttlebutt/unfollow") + .header(ContentType::Form) + .body("key=@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") + .dispatch(); + assert_eq!(response.status(), Status::SeeOther); +} + +// ADMIN SETTINGS ROUTES + +#[test] +fn admin_settings_menu_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/admin").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Administrator Settings")); + assert!(body.contains("Change Password")); + assert!(body.contains("Configure Admin")); +} + +#[test] +fn add_admin_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/admin/add").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Add Admin")); + assert!(body.contains("SSB ID")); + assert!(body.contains("Add")); + assert!(body.contains("Cancel")); +} + +#[test] +fn add_admin() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client + .post("/settings/admin/add") + .header(ContentType::Form) + .body("ssb_id=@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") + .dispatch(); + // check for redirect + assert_eq!(response.status(), Status::SeeOther); +} + +#[test] +fn change_password_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/admin/change_password").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Change Password")); + assert!(body.contains("Old Password")); + assert!(body.contains("Enter New Password")); + assert!(body.contains("Re-Enter New Password")); + assert!(body.contains("Save")); +} + +#[test] +fn configure_admin_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/admin/configure").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Configure Admin")); + assert!(body.contains("Current Admins")); + assert!(body.contains("Add Admin")); +} + +#[test] +fn forgot_password_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/admin/forgot_password").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Send Password Reset")); +} + +// NETWORK SETTINGS ROUTES + #[test] fn network_settings_menu_html() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); @@ -62,6 +316,29 @@ fn network_settings_menu_html() { assert!(body.contains("Network Configuration")); } +#[test] +fn deploy_ap() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/network/ap/activate").dispatch(); + // check for 303 status (redirect) + assert_eq!(response.status(), Status::SeeOther); + assert_eq!(response.content_type(), None); +} + +#[test] +fn dns_settings_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/network/dns").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Configure DNS")); + assert!(body.contains("External Domain (optional)")); + assert!(body.contains("Enable Dynamic DNS")); + assert!(body.contains("Dynamic DNS Domain")); + assert!(body.contains("Save")); +} + #[test] fn list_aps_html() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); @@ -84,6 +361,15 @@ fn ap_details_html() { //assert!(body.contains("Network not found")); } +#[test] +fn deploy_client() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/network/wifi/activate").dispatch(); + // check for 303 status (redirect) + assert_eq!(response.status(), Status::SeeOther); + assert_eq!(response.content_type(), None); +} + #[test] fn add_ap_html() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); @@ -114,177 +400,6 @@ fn add_ap_ssid_html() { assert!(body.contains("Cancel")); } -#[test] -fn status_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/status").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Device Status")); - assert!(body.contains("Networking")); - assert!(body.contains("Display")); - assert!(body.contains("Statistics")); -} - -#[test] -fn help_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/help").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Help")); -} - -#[test] -fn login_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/login").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Login")); -} - -#[test] -fn private_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/private").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Private Messages")); -} - -#[test] -fn peers_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/peers").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Scuttlebutt Peers")); -} - -#[test] -fn friends_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/friends").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Friends")); -} - -#[test] -fn follows_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/follows").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Follows")); -} - -#[test] -fn followers_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/followers").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Followers")); -} - -#[test] -fn block_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/blocks").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Blocks")); -} - -#[test] -fn follow() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client - .post("/scuttlebutt/follow") - .header(ContentType::Form) - .body("key=@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") - .dispatch(); - // ensure we redirect (303) - assert_eq!(response.status(), Status::SeeOther); -} - -#[test] -fn unfollow() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client - .post("/scuttlebutt/unfollow") - .header(ContentType::Form) - .body("key=@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") - .dispatch(); - assert_eq!(response.status(), Status::SeeOther); -} - -#[test] -fn block() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client - .post("/scuttlebutt/block") - .header(ContentType::Form) - .body("key=HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519") - .dispatch(); - assert_eq!(response.status(), Status::SeeOther); -} - -#[test] -fn publish_post() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client - .post("/scuttlebutt/publish") - .header(ContentType::Form) - .body("text='golden ripples in the meshwork'") - .dispatch(); - assert_eq!(response.status(), Status::SeeOther); -} - -#[test] -fn profile_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/scuttlebutt/profile").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Profile")); -} - -#[test] -fn power_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/power").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Shutdown Device")); -} - -#[test] -fn data_usage_html() { - let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/settings/network/wifi/usage").dispatch(); - assert_eq!(response.status(), Status::Ok); - assert_eq!(response.content_type(), Some(ContentType::HTML)); - let body = response.into_string().unwrap(); - assert!(body.contains("Network Data Usage")); - assert!(body.contains("WARNING THRESHOLD")); - assert!(body.contains("Update")); - assert!(body.contains("Cancel")); -} - #[test] fn add_credentials() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); @@ -322,21 +437,65 @@ fn modify_password() { } #[test] -fn deploy_ap() { +fn data_usage_html() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/settings/network/ap/activate").dispatch(); - // check for 303 status (redirect) - assert_eq!(response.status(), Status::SeeOther); - assert_eq!(response.content_type(), None); + let response = client.get("/settings/network/wifi/usage").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Network Data Usage")); + assert!(body.contains("WARNING THRESHOLD")); + assert!(body.contains("Update")); + assert!(body.contains("Cancel")); +} + +// SCUTTLEBUTT SETTINGS HTML ROUTES + +#[test] +fn scuttlebutt_settings_menu_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/settings/scuttlebutt").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Scuttlebutt Settings")); + assert!(body.contains("Set Network Key")); + assert!(body.contains("Set Replication Hops")); + assert!(body.contains("Remove Blocked Feeds")); + assert!(body.contains("Set Database Directory")); + assert!(body.contains("Check Filesystem")); + assert!(body.contains("Repair Filesystem")); + assert!(body.contains("Restart Sbot")); +} + +// STATUS HTML ROUTES + +#[test] +fn status_html() { + let client = Client::tracked(init_rocket()).expect("valid rocket instance"); + let response = client.get("/status").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Device Status")); + assert!(body.contains("Networking")); + assert!(body.contains("Display")); + assert!(body.contains("Statistics")); } #[test] -fn deploy_client() { +fn network_status_html() { let client = Client::tracked(init_rocket()).expect("valid rocket instance"); - let response = client.get("/settings/network/wifi/activate").dispatch(); - // check for 303 status (redirect) - assert_eq!(response.status(), Status::SeeOther); - assert_eq!(response.content_type(), None); + let response = client.get("/status/network").dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.content_type(), Some(ContentType::HTML)); + let body = response.into_string().unwrap(); + assert!(body.contains("Network Status")); + assert!(body.contains("Mode")); + assert!(body.contains("SSID")); + assert!(body.contains("IP")); + assert!(body.contains("DOWNLOAD")); + assert!(body.contains("UPLOAD")); } // JSON API ROUTES From 7f202ac7e9e585f528f1b53206880732328e503a Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 18 Nov 2021 11:54:21 +0200 Subject: [PATCH 4/4] fix back-link and title for change_password --- peach-web/src/routes/authentication.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/peach-web/src/routes/authentication.rs b/peach-web/src/routes/authentication.rs index 27c7cb3..035bde5 100644 --- a/peach-web/src/routes/authentication.rs +++ b/peach-web/src/routes/authentication.rs @@ -364,7 +364,7 @@ pub fn save_password_form(password_form: PasswordForm) -> Result<(), PeachWebErr pub fn change_password(flash: Option, _auth: Authenticated) -> Template { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/network".to_string()); + context.back = Some("/settings/admin".to_string()); context.title = Some("Change Password".to_string()); // check to see if there is a flash message to display if let Some(flash) = flash { @@ -383,7 +383,7 @@ pub fn change_password_post(password_form: Form, _auth: Authentica Ok(_) => { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/network".to_string()); + context.back = Some("/settings/admin".to_string()); context.title = Some("Change Password".to_string()); context.flash_name = Some("success".to_string()); context.flash_msg = Some("New password is now saved".to_string()); @@ -393,8 +393,8 @@ pub fn change_password_post(password_form: Form, _auth: Authentica Err(err) => { let mut context = ChangePasswordContext::build(); // set back icon link to network route - context.back = Some("/network".to_string()); - context.title = Some("Configure DNS".to_string()); + context.back = Some("/settings/admin".to_string()); + context.title = Some("Change Password".to_string()); context.flash_name = Some("error".to_string()); context.flash_msg = Some(format!("Failed to save new password: {}", err)); Template::render("settings/admin/change_password", &context)