Change /send_password_reset to /forgot_password #19
@ -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;
|
||||
|
||||
@ -90,7 +90,7 @@ fn init_rocket() -> Rocket<Build> {
|
||||
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
|
||||
|
||||
@ -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<FlashMessage>) -> 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<FlashMessage>) -> 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<FlashMessage>) -> 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
<input id="password" name="password" class="center input" type="password" placeholder="Password" title="Password for given username"/>
|
||||
<div id="buttonDiv">
|
||||
<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>
|
||||
</form>
|
||||
|
||||
<!-- FLASH MESSAGE -->
|
||||
<!-- check for flash message and display accordingly -->
|
||||
{% if flash_msg and flash_name == "success" %}
|
||||
@ -25,6 +25,10 @@
|
||||
<!-- display error message -->
|
||||
<div class="capsule center-text flash-message font-failure">{{ flash_msg }}.</div>
|
||||
{%- endif -%}
|
||||
|
||||
<div class="center-text" style="margin-top: 25px;">
|
||||
|
glyph marked this conversation as resolved
Outdated
|
||||
<a href="/forgot_password" class="label-small link">Forgot Password?</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
Some small (opinionated) styling suggestions here:
I would recommend setting
margin-top: 25pxinstead of50px.Then, on line 30, remove the entire
style=" ... "section and use classes from our pattern library instead:class="label-small link". The CSS styles in the library definitely need some work but I quite like sticking with classes whenever possible (makes it much easier to deploy changes across the entire interface by only tweaking a class or two, rather than having to manually edit the style of each individual element).That will make the font near-black for now. We can set it to gray once I've fixed the classes :)
Oh yeah, one other thing I noticed. You have
forgot-passwordas a class on L29. Perhaps this is meant to be theidattribute value?Thanks, made these changes. I'm not totally aware of all of the classes are available in the pattern library, but will hopefully become aware of more of them over time through code reviews. Please feel free to point them out and ways to bring the css more in alignment with the rest of the codebase.
I don't have any preference for gray or near-black, as you feel. The font looks better now too that it matches.
forgot-password was accidentally put as a class name while I was trying to figure out how to style it lol