Change /send_password_reset to /forgot_password
This commit is contained in:
parent
e3640f0885
commit
a4f459e1fc
|
@ -3,7 +3,6 @@ use crate::config_manager::{get_peachcloud_domain, load_peach_config,
|
||||||
get_temporary_password_hash, set_temporary_password_hash};
|
get_temporary_password_hash, set_temporary_password_hash};
|
||||||
use crate::error::PeachError;
|
use crate::error::PeachError;
|
||||||
use crate::sbot_client;
|
use crate::sbot_client;
|
||||||
use log::info;
|
|
||||||
use rand::distributions::Alphanumeric;
|
use rand::distributions::Alphanumeric;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
|
@ -90,7 +90,7 @@ fn init_rocket() -> Rocket<Build> {
|
||||||
change_password_post, // WEB ROUTE
|
change_password_post, // WEB ROUTE
|
||||||
reset_password, // WEB ROUTE
|
reset_password, // WEB ROUTE
|
||||||
reset_password_post, // WEB ROUTE
|
reset_password_post, // WEB ROUTE
|
||||||
send_password_reset_page, // WEB ROUTE
|
forgot_password_page, // WEB ROUTE
|
||||||
send_password_reset_post, // WEB ROUTE
|
send_password_reset_post, // WEB ROUTE
|
||||||
configure_admin, // WEB ROUTE
|
configure_admin, // WEB ROUTE
|
||||||
add_admin, // WEB ROUTE
|
add_admin, // WEB ROUTE
|
||||||
|
|
|
@ -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.
|
/// Page for users who have forgotten their password.
|
||||||
#[get("/send_password_reset")]
|
/// This route is used by a user who is not logged in
|
||||||
pub fn send_password_reset_page(flash: Option<FlashMessage>) -> Template {
|
/// to initiate the sending of a new password reset.
|
||||||
|
#[get("/forgot_password")]
|
||||||
|
pub fn forgot_password_page(flash: Option<FlashMessage>) -> Template {
|
||||||
let mut context = SendPasswordResetContext::build();
|
let mut context = SendPasswordResetContext::build();
|
||||||
context.back = Some("/".to_string());
|
context.back = Some("/".to_string());
|
||||||
context.title = Some("Send Password Reset".to_string());
|
context.title = Some("Send Password Reset".to_string());
|
||||||
|
@ -314,7 +316,7 @@ pub fn send_password_reset_page(flash: Option<FlashMessage>) -> Template {
|
||||||
context.flash_name = Some(flash.kind().to_string());
|
context.flash_name = Some(flash.kind().to_string());
|
||||||
context.flash_msg = Some(flash.message().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
|
/// 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 =
|
let flash_msg =
|
||||||
"A password reset link has been sent to the admin of this device".to_string();
|
"A password reset link has been sent to the admin of this device".to_string();
|
||||||
context.flash_msg = Some(flash_msg);
|
context.flash_msg = Some(flash_msg);
|
||||||
Template::render("password/send_password_reset", &context)
|
Template::render("password/forgot_password", &context)
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let mut context = ChangePasswordContext::build();
|
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.title = Some("Send Password Reset".to_string());
|
||||||
context.flash_name = Some("error".to_string());
|
context.flash_name = Some("error".to_string());
|
||||||
context.flash_msg = Some(format!("Failed to send password reset link: {}", err));
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<input id="password" name="password" class="center input" type="password" placeholder="Password" title="Password for given username"/>
|
<input id="password" name="password" class="center input" type="password" placeholder="Password" title="Password for given username"/>
|
||||||
<div id="buttonDiv">
|
<div id="buttonDiv">
|
||||||
<input id="loginUser" class="button button-primary center" title="Login" type="submit" value="Login">
|
<input id="loginUser" class="button button-primary center" title="Login" type="submit" value="Login">
|
||||||
<a class="button button-secondary center" href="/" title="Cancel">Cancel</a>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- FLASH MESSAGE -->
|
<!-- FLASH MESSAGE -->
|
||||||
<!-- check for flash message and display accordingly -->
|
<!-- check for flash message and display accordingly -->
|
||||||
{% if flash_msg and flash_name == "success" %}
|
{% if flash_msg and flash_name == "success" %}
|
||||||
|
@ -25,6 +25,10 @@
|
||||||
<!-- display error message -->
|
<!-- display error message -->
|
||||||
<div class="capsule center-text flash-message font-failure">{{ flash_msg }}.</div>
|
<div class="capsule center-text flash-message font-failure">{{ flash_msg }}.</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div class="forgot-password center-text" style="margin-top: 50px;">
|
||||||
|
<a href="/forgot_password" style="text-decoration: none; color: gray;">Forgot Password?</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue