simplify functions
This commit is contained in:
src
@ -10,7 +10,7 @@ use crate::constants::{APP_NAME, MAX_FAILED_LOGIN_ATTEMPTS, MIN_PASS_LEN};
|
||||
use crate::controllers::base_controller::{FatalErrorPage, redirect_user};
|
||||
use crate::data::app_config::AppConfig;
|
||||
use crate::data::session_identity::{SessionIdentity, SessionStatus};
|
||||
use crate::utils::network_utils::{get_remote_ip, parse_ip};
|
||||
use crate::utils::network_utils::get_remote_ip;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "base_login_page.html")]
|
||||
@ -62,14 +62,7 @@ pub async fn login_route(
|
||||
let mut success = String::new();
|
||||
let mut login = String::new();
|
||||
|
||||
let remote_ip = match parse_ip(&get_remote_ip(&http_req, config.proxy_ip.as_deref())) {
|
||||
None => return HttpResponse::InternalServerError().body(
|
||||
FatalErrorPage {
|
||||
message: "Failed to determine remote ip address!"
|
||||
}.render().unwrap()
|
||||
),
|
||||
Some(i) => i,
|
||||
};
|
||||
let remote_ip = get_remote_ip(&http_req, config.proxy_ip.as_deref());
|
||||
|
||||
let failed_attempts = bruteforce.send(bruteforce_actor::CountFailedAttempt { ip: remote_ip })
|
||||
.await.unwrap();
|
||||
|
Reference in New Issue
Block a user