Clean up comments
This commit is contained in:
parent
309ec94cdb
commit
e3640f0885
@ -34,7 +34,7 @@ pub fn validate_new_passwords(new_password1: &str, new_password2: &str) -> Resul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uses htpasswd to set a new password for the admin user
|
/// Sets a new password for the admin user
|
||||||
pub fn set_new_password(new_password: &str) -> Result<(), PeachError> {
|
pub fn set_new_password(new_password: &str) -> Result<(), PeachError> {
|
||||||
let new_password_hash = hash_password(&new_password.to_string());
|
let new_password_hash = hash_password(&new_password.to_string());
|
||||||
let result = set_admin_password_hash(&new_password_hash);
|
let result = set_admin_password_hash(&new_password_hash);
|
||||||
@ -55,7 +55,7 @@ pub fn hash_password(password: &str) -> String {
|
|||||||
hasher.result_str()
|
hasher.result_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uses htpasswd to set a new temporary password for the admin user
|
/// Sets a new temporary password for the admin user
|
||||||
/// which can be used to reset the permanent password
|
/// which can be used to reset the permanent password
|
||||||
pub fn set_new_temporary_password(new_password: &str) -> Result<(), PeachError> {
|
pub fn set_new_temporary_password(new_password: &str) -> Result<(), PeachError> {
|
||||||
let new_password_hash = hash_password(&new_password.to_string());
|
let new_password_hash = hash_password(&new_password.to_string());
|
||||||
@ -82,7 +82,7 @@ pub fn verify_temporary_password(password: &str) -> Result<(), PeachError> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generates a temporary password and sends it via ssb dm
|
/// Generates a temporary password and sends it via ssb dm
|
||||||
/// to the ssb id configured to be the admin of the peachcloud device
|
/// to the ssb id configured to be the admin of the peachcloud device
|
||||||
pub fn send_password_reset() -> Result<(), PeachError> {
|
pub fn send_password_reset() -> Result<(), PeachError> {
|
||||||
// first generate a new random password of ascii characters
|
// first generate a new random password of ascii characters
|
||||||
@ -119,7 +119,6 @@ using this link: http://peach.local/reset_password",
|
|||||||
msg += &remote_link;
|
msg += &remote_link;
|
||||||
// finally send the message to the admins
|
// finally send the message to the admins
|
||||||
let peach_config = load_peach_config()?;
|
let peach_config = load_peach_config()?;
|
||||||
info!("sending password reset: {}", msg);
|
|
||||||
for ssb_admin_id in peach_config.ssb_admin_ids {
|
for ssb_admin_id in peach_config.ssb_admin_ids {
|
||||||
sbot_client::private_message(&msg, &ssb_admin_id)?;
|
sbot_client::private_message(&msg, &ssb_admin_id)?;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ pub enum LoginError {
|
|||||||
UserNotLoggedIn
|
UserNotLoggedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Request guard which returns an Authenticated struct with is_authenticated=true
|
/// Request guard which returns an empty Authenticated struct from the request
|
||||||
/// iff the user has a cookie which proves they are authenticated with peach-web.
|
/// if and only if the user has a cookie which proves they are authenticated with peach-web.
|
||||||
///
|
///
|
||||||
/// Note that cookies.get_private uses encryption, which means that this private cookie
|
/// Note that cookies.get_private uses encryption, which means that this private cookie
|
||||||
/// cannot be inspected, tampered with, or manufactured by clients.
|
/// cannot be inspected, tampered with, or manufactured by clients.
|
||||||
@ -114,7 +114,6 @@ pub fn verify_login_form(login_form: LoginForm) -> Result<(), PeachError> {
|
|||||||
|
|
||||||
#[post("/login", data="<login_form>")]
|
#[post("/login", data="<login_form>")]
|
||||||
pub fn login_post(login_form: Form<LoginForm>, cookies: &CookieJar<'_>) -> TemplateOrRedirect {
|
pub fn login_post(login_form: Form<LoginForm>, cookies: &CookieJar<'_>) -> TemplateOrRedirect {
|
||||||
info!("call to login post");
|
|
||||||
let result = verify_login_form(login_form.into_inner());
|
let result = verify_login_form(login_form.into_inner());
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user