mirror of
https://github.com/ZeusWPI/ZNS.git
synced 2024-11-22 05:41:11 +01:00
Fix bugs
This commit is contained in:
parent
5d59f1bd97
commit
e99ba5c97e
3 changed files with 18 additions and 12 deletions
|
@ -1,4 +1,5 @@
|
||||||
use diesel::PgConnection;
|
use diesel::PgConnection;
|
||||||
|
use reqwest::header::ACCEPT;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::Config,
|
config::Config,
|
||||||
|
@ -34,11 +35,15 @@ pub async fn authenticate(
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn validate_ssh(username: &String, sig: &Sig) -> Result<bool, reqwest::Error> {
|
async fn validate_ssh(username: &String, sig: &Sig) -> Result<bool, reqwest::Error> {
|
||||||
Ok(reqwest::get(format!(
|
let client = reqwest::Client::new();
|
||||||
"{}/users/keys/{}",
|
Ok(client
|
||||||
|
.get(format!(
|
||||||
|
"{}/users/{}/keys",
|
||||||
Config::get().zauth_url,
|
Config::get().zauth_url,
|
||||||
username
|
username
|
||||||
))
|
))
|
||||||
|
.header(ACCEPT, "application/json")
|
||||||
|
.send()
|
||||||
.await?
|
.await?
|
||||||
.json::<Vec<String>>()
|
.json::<Vec<String>>()
|
||||||
.await?
|
.await?
|
||||||
|
|
|
@ -71,7 +71,9 @@ impl<'a> Reader<'a> {
|
||||||
message: String::from("Seeking into the future is not allowed!!"),
|
message: String::from("Seeking into the future is not allowed!!"),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Ok(Reader::new(&self.buffer[position..self.position]))
|
let mut reader = Reader::new(&self.buffer[0..self.position]);
|
||||||
|
reader.position = position;
|
||||||
|
Ok(reader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ async fn get_response(bytes: &[u8]) -> Message {
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:#?}", message);
|
|
||||||
eprintln!("{}", e.to_string());
|
eprintln!("{}", e.to_string());
|
||||||
message.set_response(e.rcode());
|
message.set_response(e.rcode());
|
||||||
message
|
message
|
||||||
|
|
Loading…
Reference in a new issue