Skip to content

Commit

Permalink
cursed
Browse files Browse the repository at this point in the history
This reverts commit 1097264.
  • Loading branch information
JieningYu committed Jan 3, 2024
1 parent 1097264 commit 7ce3f11
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ rand = "0.8"
siphasher = "1.0"
highway = "1.1"
async-trait = "0.1"
futures = "0.3"

[dev-dependencies]
tower = "0.4"
Expand Down
40 changes: 19 additions & 21 deletions src/handle/account.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
use std::{
collections::{HashMap, HashSet},
future::ready,
num::NonZeroU64,
pin::{pin, Pin},
};

use axum::{
extract::{Path, State},
Json,
};
use dmds::IoHandle;
use futures::StreamExt;
use dmds::{IoHandle, StreamExt};
use libaccount::{
tag::{AsPermission, Tags},
Phone, VerifyDescriptor,
Expand Down Expand Up @@ -50,23 +47,24 @@ pub async fn send_captcha<Io: IoHandle>(
.unverified_account
.select(0, unverified.email_hash())
.hint(unverified.email_hash());
let iter = select
.iter()
.filter_map(|r| ready(r.ok()))
.filter(|v| ready(v.id() == unverified.email_hash()));
let res = if let Some(mut l) = pin!(iter).next().await {
l.get_mut()
.await?
.send_captcha(&config.smtp, &smtp_transport, &test_cx)
.await
} else {
unverified
.send_captcha(&config.smtp, &smtp_transport, &test_cx)
.await?;
worlds.unverified_account.insert(unverified).await?;
Ok(())
};
res
let mut iter = select.iter();
while let Some(Ok(mut lazy)) = iter.next().await {
if lazy.id() == unverified.email_hash() {
if let Ok(val) = lazy.get_mut().await {
if val.email() == unverified.email() {
val.send_captcha(&config.smtp, &smtp_transport, &test_cx)
.await?;
return Ok(());
}
}
}
}

unverified
.send_captcha(&config.smtp, &smtp_transport, &test_cx)
.await?;
worlds.unverified_account.insert(unverified).await?;
Ok(())
}

#[derive(Deserialize)]
Expand Down

0 comments on commit 7ce3f11

Please sign in to comment.