diff --git a/peach-lib/src/password_utils.rs b/peach-lib/src/password_utils.rs index 047d3be5..f60b8616 100644 --- a/peach-lib/src/password_utils.rs +++ b/peach-lib/src/password_utils.rs @@ -3,7 +3,6 @@ use crate::config_manager::{get_peachcloud_domain, load_peach_config, get_temporary_password_hash, set_temporary_password_hash}; use crate::error::PeachError; use crate::sbot_client; -use log::info; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use std::iter; diff --git a/peach-web/src/main.rs b/peach-web/src/main.rs index 1f12ab27..1d073e68 100644 --- a/peach-web/src/main.rs +++ b/peach-web/src/main.rs @@ -90,7 +90,7 @@ fn init_rocket() -> Rocket { change_password_post, // WEB ROUTE reset_password, // WEB ROUTE reset_password_post, // WEB ROUTE - send_password_reset_page, // WEB ROUTE + forgot_password_page, // WEB ROUTE send_password_reset_post, // WEB ROUTE configure_admin, // WEB ROUTE add_admin, // WEB ROUTE diff --git a/peach-web/src/routes/authentication.rs b/peach-web/src/routes/authentication.rs index a55a0c0c..7c71799f 100644 --- a/peach-web/src/routes/authentication.rs +++ b/peach-web/src/routes/authentication.rs @@ -302,9 +302,11 @@ impl SendPasswordResetContext { } } -/// Password reset request handler. This route is used by a user who is not logged in to send a new password reset link. -#[get("/send_password_reset")] -pub fn send_password_reset_page(flash: Option) -> Template { +/// Page for users who have forgotten their password. +/// This route is used by a user who is not logged in +/// to initiate the sending of a new password reset. +#[get("/forgot_password")] +pub fn forgot_password_page(flash: Option) -> Template { let mut context = SendPasswordResetContext::build(); context.back = Some("/".to_string()); context.title = Some("Send Password Reset".to_string()); @@ -314,7 +316,7 @@ pub fn send_password_reset_page(flash: Option) -> Template { context.flash_name = Some(flash.kind().to_string()); context.flash_msg = Some(flash.message().to_string()); }; - Template::render("password/send_password_reset", &context) + Template::render("password/forgot_password", &context) } /// Send password reset request handler. This route is used by a user who is not logged in @@ -333,7 +335,7 @@ pub fn send_password_reset_post() -> Template { let flash_msg = "A password reset link has been sent to the admin of this device".to_string(); context.flash_msg = Some(flash_msg); - Template::render("password/send_password_reset", &context) + Template::render("password/forgot_password", &context) } Err(err) => { let mut context = ChangePasswordContext::build(); @@ -341,7 +343,7 @@ pub fn send_password_reset_post() -> Template { context.title = Some("Send Password Reset".to_string()); context.flash_name = Some("error".to_string()); context.flash_msg = Some(format!("Failed to send password reset link: {}", err)); - Template::render("password/send_password_reset", &context) + Template::render("password/forgot_password", &context) } } } diff --git a/peach-web/templates/login.html.tera b/peach-web/templates/login.html.tera index c64943b2..91995950 100644 --- a/peach-web/templates/login.html.tera +++ b/peach-web/templates/login.html.tera @@ -10,9 +10,9 @@
- Cancel
+ {% if flash_msg and flash_name == "success" %} @@ -25,6 +25,10 @@
{{ flash_msg }}.
{%- endif -%} + + diff --git a/peach-web/templates/password/send_password_reset.html.tera b/peach-web/templates/password/forgot_password.html.tera similarity index 100% rename from peach-web/templates/password/send_password_reset.html.tera rename to peach-web/templates/password/forgot_password.html.tera