diff --git a/src/lib.rs b/src/lib.rs index 7afa4b5..bf4716c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ use sqlx::{Error, Pool, Sqlite}; use std::str::FromStr; use std::time::{SystemTime, UNIX_EPOCH}; -use tide::prelude::*; pub async fn db_init(database: &str) -> Result, Error> { let pool = SqlitePoolOptions::new() diff --git a/src/main.rs b/src/main.rs index b8394ab..6bef628 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use ldap3::{LdapConn, Mod, Scope, SearchEntry}; -use ldap3::exop::{PasswordModify, PasswordModifyResp}; +use ldap3::exop::PasswordModify; use std::collections::HashSet; // for teh webserver @@ -106,28 +106,25 @@ async fn post_update_ldap(mut req: Request) -> tide::Result { // check if the password field itself is being updated let (pass_old, pass_new) = if &field != "userPassword" { // if password is not being updated then just update the required field - let mods = vec![ - Mod::Replace(field, HashSet::from([value])) - ]; + let mods = vec![Mod::Replace(field, HashSet::from([value]))]; ldap.modify(&dn, mods)?.success()?; - - - // pass back the "old" and "new" passwords + + // pass back the "old" and "new" passwords (pass.clone(), pass.clone()) } else { // password is going to be updated, even if the old value is not starting with "{SSHA512}" - + pw_keep_same = false; - (pass.clone(), value.clone()) + (pass.clone(), value) }; if !pw_keep_same { // really easy to update password once ye know how - - let tmp = PasswordModify{ + + let tmp = PasswordModify { // none as we are staying on the same connection user_id: None, - + old_pass: Some(&pass_old), new_pass: Some(&pass_new), }; @@ -140,35 +137,34 @@ async fn post_update_ldap(mut req: Request) -> tide::Result { Ok(json!({"result": "success"}).into()) } - /* Create new account - - 1. Check if ID is available - 2. Ask user to fill in: - * uid - * First Name - * Surname Name - * Wolves email - 3. Email + link is sent to wolves email - * only if its paid up and it hasn't been used before - 4. Ldap entry created - 5. Email with initial pw is sent to user - 6. Account added to skynet-users (they are paid up) - */ + 1. Check if ID is available + 2. Ask user to fill in: + * uid + * First Name + * Surname Name + * Wolves email + 3. Email + link is sent to wolves email + * only if its paid up and it hasn't been used before + 4. Ldap entry created + 5. Email with initial pw is sent to user + 6. Account added to skynet-users (they are paid up) + +*/ /* Join existing account to wolves - related to above + related to above - */ +*/ /* Password reset via email - */ +*/ /* script to pull in all active members from wolves - update the groups - check if there are any pending signups + update the groups + check if there are any pending signups - */ +*/