Log all user actions on stdout
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-19 13:38:24 +01:00
parent c242a492fc
commit d06c0352fc
14 changed files with 323 additions and 21 deletions

View File

@ -6,6 +6,7 @@ use crate::actors::bruteforce_actor::BruteForceActor;
use crate::actors::users_actor::UsersActor;
use crate::actors::{bruteforce_actor, users_actor};
use crate::constants::{APP_NAME, MAX_FAILED_LOGIN_ATTEMPTS, MIN_PASS_LEN};
use crate::data::action_logger::{Action, ActionLogger};
use crate::data::app_config::AppConfig;
use crate::data::current_user::CurrentUser;
use crate::data::remote_ip::RemoteIP;
@ -82,6 +83,7 @@ pub async fn change_password_route(
req: Option<web::Form<PassChangeRequest>>,
bruteforce: web::Data<Addr<BruteForceActor>>,
remote_ip: RemoteIP,
logger: ActionLogger,
) -> impl Responder {
let mut danger = None;
let mut success = None;
@ -130,6 +132,7 @@ pub async fn change_password_route(
danger =
Some("An error occurred while trying to change your password!".to_string());
} else {
logger.log(Action::ChangedHisPassword);
success = Some("Your password was successfully changed!".to_string());
}
}