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)
|
||||
.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<Pool<Sqlite>, 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<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_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<String>, rep
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uid_to_dn(uid: &str) -> String {
|
||||
format!("uid={},ou=users,dc=skynet,dc=ie", uid)
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue