Add ability to export account

This commit is contained in:
Ethan O'Brien
2024-05-27 15:31:07 -05:00
parent dae95f5aa3
commit 0b969eab97
4 changed files with 49 additions and 2 deletions

View File

@@ -215,6 +215,21 @@ pub fn admin_post(req: HttpRequest, body: String) -> HttpResponse {
result: "OK"
};
HttpResponse::Ok()
.insert_header(ContentType::json())
.body(json::stringify(resp))
.insert_header(ContentType::json())
.body(json::stringify(resp))
}
pub fn export(req: HttpRequest) -> HttpResponse {
let token = get_login_token(&req);
if token.is_none() {
return error("Not logged in");
}
let resp = object!{
result: "OK",
data: userdata::export_user(&token.unwrap()).unwrap()
};
HttpResponse::Ok()
.insert_header(ContentType::json())
.body(json::stringify(resp))
}