fix auth routes

This commit is contained in:
glyph 2021-11-17 11:39:09 +02:00
parent 9f1f48bb6c
commit 3e0b6d908a
1 changed files with 3 additions and 5 deletions

View File

@ -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<FlashMessage>) -> Template {
let mut context = ResetPasswordContext::build();
@ -223,7 +222,6 @@ pub fn reset_password(flash: Option<FlashMessage>) -> 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 = "<reset_password_form>")]
pub fn reset_password_post(reset_password_form: Form<ResetPasswordForm>) -> 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<FlashMessage>, _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<PasswordForm>, _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<PasswordForm>, _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));