Add a way to reset password

This commit is contained in:
Greg Burri 2024-11-09 11:22:53 +01:00
parent 5d343c273f
commit ed979719b5
12 changed files with 352 additions and 57 deletions

View file

@ -18,3 +18,24 @@ pub fn get_ip_and_user_agent(headers: &HeaderMap, remote_address: SocketAddr) ->
(ip, user_agent)
}
pub fn get_url_from_host(host: &str) -> String {
let port: Option<u16> = 'p: {
let split_port: Vec<&str> = host.split(':').collect();
if split_port.len() == 2 {
if let Ok(p) = split_port[1].parse::<u16>() {
break 'p Some(p);
}
}
None
};
format!(
"http{}://{}",
if port.is_some() && port.unwrap() != 443 {
""
} else {
"s"
},
host
)
}