add 2fa
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-06-11 11:40:21 +09:00
parent 6513d626de
commit 81db8cfe29
3 changed files with 72 additions and 37 deletions

View File

@ -1,12 +1,17 @@
use crate::http_client::HttpClient;
use std::collections::HashMap;
pub async fn post_request(handle: String, pass: String, host: String) -> String {
pub async fn post_request(handle: String, pass: String, host: String, auth_factor_token: Option<String>) -> String {
let url = format!("https://{}/xrpc/com.atproto.server.createSession", host);
let mut map = HashMap::new();
map.insert("identifier", &handle);
map.insert("password", &pass);
// Add 2FA code if provided
if let Some(code) = &auth_factor_token {
map.insert("authFactorToken", code);
}
let client = HttpClient::new();