diff --git a/Cargo.lock b/Cargo.lock index 9842641..29677ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -691,7 +691,7 @@ dependencies = [ [[package]] name = "libaccount" version = "0.1.0" -source = "git+https://github.com/subitlab-buf/libaccount.git?branch=tags#982585e7f3a6e08891d65d0a0bfdf406209a832b" +source = "git+https://github.com/subitlab-buf/libaccount.git?branch=tags#8326504e84de8c7b7ba0f22dbd1b1cb36cbda50f" dependencies = [ "rand", "serde", diff --git a/src/main.rs b/src/main.rs index a6297ec..c533250 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,6 +99,11 @@ pub struct Auth { } impl Auth { + #[inline] + pub fn new(account: u64, token: String) -> Self { + Self { account, token } + } + const KEY: &str = "Authorization"; #[cfg(test)] diff --git a/src/tests/account.rs b/src/tests/account.rs index cc88ba2..292ea03 100644 --- a/src/tests/account.rs +++ b/src/tests/account.rs @@ -20,6 +20,8 @@ async fn creation() { .await .expect("captcha not sent"); + // Verify the account. + // Simulates a wrong captcha. let wrong_captcha = sms4_backend::account::verify::Captcha::from(captcha.into_inner() + 1); let res = req!(route => REGISTER, @@ -88,3 +90,8 @@ async fn creation() { ) ) } + +#[tokio::test] +async fn login() { + let (state, route) = router(); +}