Implement webui import

This commit is contained in:
Ethan O'Brien
2024-04-25 12:54:20 -05:00
parent 5ccb65732f
commit 32c331c7a9
12 changed files with 295 additions and 74 deletions

View File

@@ -104,6 +104,14 @@ fn get_new_uuid() -> String {
id
}
pub fn import_user(uid: i64) -> String {
let token = get_new_uuid();
lock_and_exec(
"INSERT INTO users (cert, uuid, user_id) VALUES (?1, ?2, ?3)",
params!("", token, uid)
);
token
}
fn update_cert(uid: i64, cert: &str) {
lock_and_exec("UPDATE users SET cert=?1 WHERE user_id=?2", params!(cert, uid));
}
@@ -187,7 +195,6 @@ fn decrypt_transfer_password(password: &str) -> String {
}
pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
let body = json::parse(&body).unwrap();
let token = create_acc(&body["token"].to_string());