44 lines
2.0 KiB
Rust
44 lines
2.0 KiB
Rust
use maud::{html, PreEscaped};
|
|
|
|
use crate::{templates, utils::theme};
|
|
|
|
// ROUTE: /auth/forgot
|
|
|
|
/// Forgot password template builder.
|
|
pub fn build_template() -> PreEscaped<String> {
|
|
let form_template = html! {
|
|
(PreEscaped("<!-- PASSWORD RESET REQUEST CARD -->"))
|
|
div class="card center" {
|
|
div class="capsule capsule-container border-info" {
|
|
p class="card-text" {
|
|
"Click the 'Send Temporary Password' button to send a new temporary password which can be used to change your device password."
|
|
}
|
|
p class="card-text" style="margin-top: 1rem;" {
|
|
"The temporary password will be sent in an SSB private message to the admin of this device."
|
|
}
|
|
p class="card-text" style="margin-top: 1rem;" {
|
|
"Once you have the temporary password, click the 'Set New Password' button to reach the password reset page."
|
|
}
|
|
}
|
|
form id="sendPasswordReset" action="/auth/send_password_reset" method="post" {
|
|
div id="buttonDiv" {
|
|
input class="button button-primary center" style="margin-top: 1rem;" type="submit" value="Send Temporary Password" title="Send temporary password to Scuttlebutt admin";
|
|
a href="/auth/reset_password" class="button button-primary center" title="Set a new password using the temporary password" {
|
|
"Set New Password"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
// wrap the nav bars around the settings menu template content
|
|
// parameters are template, title and back url
|
|
let body = templates::nav::build_template(form_template, "Send Password Reset", Some("/"));
|
|
|
|
// query the current theme so we can pass it into the base template builder
|
|
let theme = theme::get_theme();
|
|
|
|
// render the base template with the provided body
|
|
templates::base::build_template(body, theme)
|
|
}
|