Skip to content

Commit 11abc8c

Browse files
committed
wrong header
1 parent fc10865 commit 11abc8c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/admin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'r> FromRequest<'r> for Admin {
3232
};
3333

3434
let mut ipv4_address = None;
35-
for header in req.headers().get("X-Forwarded-For") {
35+
for header in req.headers().get("X-Real-IP") {
3636
if header.contains('.') {
3737
ipv4_address = Some(header.to_string());
3838
break;

src/twofactor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub async fn twofactor_validate(mut db: Connection<Cmdb>, admin: Admin, cid: Str
1111
};
1212

1313
match query("UPDATE twofactor SET approved = 1 WHERE cid = ? AND ckey = ? AND ip = ?").bind(cid).bind(&admin.username).bind(ip_addr).execute(&mut **db).await {
14-
Ok(res) => if res.rows_affected() > 0 { "Two factor request updated.".to_string() } else { "An error occured.".to_string() },
14+
Ok(res) => if res.rows_affected() > 0 { "Two factor request updated.".to_string() } else { format!("An error occured: {}.", &ip_addr) },
1515
Err(err) => format!("An error occured: {:?}", err).to_string(),
1616
}
1717

0 commit comments

Comments
 (0)