aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command/anonymous.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-06-22 17:25:04 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-06-22 17:25:04 +0200
commitac974184def76fefba6c36c5c9e0ff0298f860ff (patch)
tree2df5bdce347e0fc410a48d0c6f1dbdd49e29608b /src/imap/command/anonymous.rs
parent50b19729878938b63ea33d4dbdcfd254b4462110 (diff)
downloadaerogramme-ac974184def76fefba6c36c5c9e0ff0298f860ff.tar.gz
aerogramme-ac974184def76fefba6c36c5c9e0ff0298f860ff.zip
Refactor selected
Diffstat (limited to 'src/imap/command/anonymous.rs')
-rw-r--r--src/imap/command/anonymous.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index c6af354..7a5e514 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -13,7 +13,7 @@ use crate::imap::session::InnerContext;
pub async fn dispatch<'a>(ctx: InnerContext<'a>) -> Result<(Response, flow::Transition)> {
match &ctx.req.body {
CommandBody::Capability => capability(ctx).await,
- CommandBody::Login { username, password } => login(ctx, username.clone(), password.clone()).await,
+ CommandBody::Login { username, password } => login(ctx, username, password).await,
_ => Status::no(Some(ctx.req.tag.clone()), None, "This command is not available in the ANONYMOUS state.")
.map(|s| (vec![ImapRes::Status(s)], flow::Transition::No))
.map_err(Error::msg),
@@ -34,8 +34,8 @@ async fn capability<'a>(ctx: InnerContext<'a>) -> Result<(Response, flow::Transi
Ok((res, flow::Transition::No))
}
-async fn login<'a>(ctx: InnerContext<'a>, username: AString, password: AString) -> Result<(Response, flow::Transition)> {
- let (u, p) = (String::try_from(username)?, String::try_from(password)?);
+async fn login<'a>(ctx: InnerContext<'a>, username: &AString, password: &AString) -> Result<(Response, flow::Transition)> {
+ let (u, p) = (String::try_from(username.clone())?, String::try_from(password.clone())?);
tracing::info!(user = %u, "command.login");
let creds = match ctx.login.login(&u, &p).await {