Implement "real" authentication

This commit is contained in:
Ethan O'Brien
2024-02-26 20:38:08 -06:00
parent 6388d8e4be
commit 9f28840c77
2 changed files with 64 additions and 38 deletions

View File

@ -10,9 +10,10 @@ pub fn dummy(req: HttpRequest, _body: String) -> HttpResponse {
//let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
let blank_header = HeaderValue::from_static("");
let key = req.headers().get("a6573cbe").unwrap_or(&blank_header).to_str().unwrap_or("");
let user = userdata::get_acc(key, "");
let uid = req.headers().get("aoharu-user-id").unwrap_or(&blank_header).to_str().unwrap_or("");
let user = userdata::get_acc(key, uid);
println!("new uid: {}", user["user"]["id"].clone());
println!("Signin from uid: {}", user["user"]["id"].clone());
let resp = object!{
"code": 0,
"server_time": global::timestamp(),