fix: fmt and clippy
This commit is contained in:
parent
47e62b9c46
commit
0b385cafab
3 changed files with 22 additions and 16 deletions
24
src/lib.rs
24
src/lib.rs
|
@ -88,8 +88,12 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
|
||||||
.execute(&pool)
|
.execute(&pool)
|
||||||
.await?;
|
.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_auth_code ON accounts_new (auth_code)")
|
||||||
sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry)").execute(&pool).await?;
|
.execute(&pool)
|
||||||
|
.await?;
|
||||||
|
sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry)")
|
||||||
|
.execute(&pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
"CREATE TABLE IF NOT EXISTS accounts_reset (
|
"CREATE TABLE IF NOT EXISTS accounts_reset (
|
||||||
|
@ -101,8 +105,12 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
|
||||||
.execute(&pool)
|
.execute(&pool)
|
||||||
.await?;
|
.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_auth_code ON accounts_reset (auth_code)")
|
||||||
sqlx::query("CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_reset (date_expiry)").execute(&pool).await?;
|
.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
|
// this is for active use
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
|
@ -121,7 +129,9 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, 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_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_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)
|
Ok(pool)
|
||||||
}
|
}
|
||||||
|
@ -273,7 +283,3 @@ pub async fn update_group(config: &Config, group: &str, users: &Vec<String>, rep
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uid_to_dn(uid: &str) -> String {
|
|
||||||
format!("uid={},ou=users,dc=skynet,dc=ie", uid)
|
|
||||||
}
|
|
||||||
|
|
|
@ -409,12 +409,12 @@ pub mod account {
|
||||||
|
|
||||||
ldap.extended(tmp).unwrap();
|
ldap.extended(tmp).unwrap();
|
||||||
|
|
||||||
// user is already verified by being an active member on wolves
|
// 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 {
|
if let Err(e) = update_group(config, "skynet-users", &vec![username.to_string()], true).await {
|
||||||
println!("Couldnt add {} to skynet-users: {:?}", username, e)
|
println!("Couldnt add {} to skynet-users: {:?}", username, e)
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap.unbind()?;
|
ldap.unbind()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue