From 0b385cafab32bb1adc32abbc029eabab065edb3d Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sun, 6 Aug 2023 18:11:07 +0100 Subject: [PATCH] fix: fmt and clippy --- src/lib.rs | 24 +++++++++++++++--------- src/main.rs | 4 ++-- src/methods/account_new.rs | 10 +++++----- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e407749..03e5a51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,8 +88,12 @@ pub async fn db_init(config: &Config) -> Result, Error> { .execute(&pool) .await?; - sqlx::query("CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_new (auth_code)").execute(&pool).await?; - sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry)").execute(&pool).await?; + sqlx::query("CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_new (auth_code)") + .execute(&pool) + .await?; + sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry)") + .execute(&pool) + .await?; sqlx::query( "CREATE TABLE IF NOT EXISTS accounts_reset ( @@ -101,8 +105,12 @@ pub async fn db_init(config: &Config) -> Result, Error> { .execute(&pool) .await?; - sqlx::query("CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_reset (auth_code)").execute(&pool).await?; - sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_reset (date_expiry)").execute(&pool).await?; + sqlx::query("CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_reset (auth_code)") + .execute(&pool) + .await?; + sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_reset (date_expiry)") + .execute(&pool) + .await?; // this is for active use sqlx::query( @@ -121,7 +129,9 @@ pub async fn db_init(config: &Config) -> Result, Error> { sqlx::query("CREATE INDEX IF NOT EXISTS index_uid_number ON accounts (uid)").execute(&pool).await?; sqlx::query("CREATE INDEX IF NOT EXISTS index_mail ON accounts (mail)").execute(&pool).await?; - sqlx::query("CREATE INDEX IF NOT EXISTS index_student_id ON accounts (student_id)").execute(&pool).await?; + sqlx::query("CREATE INDEX IF NOT EXISTS index_student_id ON accounts (student_id)") + .execute(&pool) + .await?; Ok(pool) } @@ -273,7 +283,3 @@ pub async fn update_group(config: &Config, group: &str, users: &Vec, rep Ok(()) } - -pub fn uid_to_dn(uid: &str) -> String { - format!("uid={},ou=users,dc=skynet,dc=ie", uid) -} diff --git a/src/main.rs b/src/main.rs index 1f7c3ff..e3992ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,11 +22,11 @@ async fn main() -> tide::Result<()> { // for users to update their own profile app.at("/ldap/update").post(account_update::submit); - + // for new users app.at("/ldap/new/email").post(account_new::email::submit); app.at("/ldap/new/account").post(account_new::account::submit); - + // for folks who forget password/username app.at("/ldap/recover/password").post(account_recover::password::reset); app.at("/ldap/recover/password/auth").post(account_recover::password::auth); diff --git a/src/methods/account_new.rs b/src/methods/account_new.rs index ebbdd63..4e40b46 100644 --- a/src/methods/account_new.rs +++ b/src/methods/account_new.rs @@ -409,12 +409,12 @@ pub mod account { ldap.extended(tmp).unwrap(); - // user is already verified by being an active member on wolves - if let Err(e) = update_group(config, "skynet-users", &vec![username.to_string()], true).await { - println!("Couldnt add {} to skynet-users: {:?}", username, e) - } + // user is already verified by being an active member on wolves + if let Err(e) = update_group(config, "skynet-users", &vec![username.to_string()], true).await { + println!("Couldnt add {} to skynet-users: {:?}", username, e) + } - ldap.unbind()?; + ldap.unbind()?; Ok(()) }