fmt: fmt and clippy
This commit is contained in:
parent
aa196ba33b
commit
82ce0a864f
2 changed files with 28 additions and 33 deletions
|
@ -3,7 +3,6 @@ use sqlx::{Error, Pool, Sqlite};
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use tide::prelude::*;
|
|
||||||
|
|
||||||
pub async fn db_init(database: &str) -> Result<Pool<Sqlite>, Error> {
|
pub async fn db_init(database: &str) -> Result<Pool<Sqlite>, Error> {
|
||||||
let pool = SqlitePoolOptions::new()
|
let pool = SqlitePoolOptions::new()
|
||||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -1,6 +1,6 @@
|
||||||
use ldap3::{LdapConn, Mod, Scope, SearchEntry};
|
use ldap3::{LdapConn, Mod, Scope, SearchEntry};
|
||||||
|
|
||||||
use ldap3::exop::{PasswordModify, PasswordModifyResp};
|
use ldap3::exop::PasswordModify;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
// for teh webserver
|
// for teh webserver
|
||||||
|
@ -106,25 +106,22 @@ async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
|
||||||
// check if the password field itself is being updated
|
// check if the password field itself is being updated
|
||||||
let (pass_old, pass_new) = if &field != "userPassword" {
|
let (pass_old, pass_new) = if &field != "userPassword" {
|
||||||
// if password is not being updated then just update the required field
|
// if password is not being updated then just update the required field
|
||||||
let mods = vec![
|
let mods = vec![Mod::Replace(field, HashSet::from([value]))];
|
||||||
Mod::Replace(field, HashSet::from([value]))
|
|
||||||
];
|
|
||||||
ldap.modify(&dn, mods)?.success()?;
|
ldap.modify(&dn, mods)?.success()?;
|
||||||
|
|
||||||
|
|
||||||
// pass back the "old" and "new" passwords
|
// pass back the "old" and "new" passwords
|
||||||
(pass.clone(), pass.clone())
|
(pass.clone(), pass.clone())
|
||||||
} else {
|
} else {
|
||||||
// password is going to be updated, even if the old value is not starting with "{SSHA512}"
|
// password is going to be updated, even if the old value is not starting with "{SSHA512}"
|
||||||
|
|
||||||
pw_keep_same = false;
|
pw_keep_same = false;
|
||||||
(pass.clone(), value.clone())
|
(pass.clone(), value)
|
||||||
};
|
};
|
||||||
|
|
||||||
if !pw_keep_same {
|
if !pw_keep_same {
|
||||||
// really easy to update password once ye know how
|
// really easy to update password once ye know how
|
||||||
|
|
||||||
let tmp = PasswordModify{
|
let tmp = PasswordModify {
|
||||||
// none as we are staying on the same connection
|
// none as we are staying on the same connection
|
||||||
user_id: None,
|
user_id: None,
|
||||||
|
|
||||||
|
@ -140,7 +137,6 @@ async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
|
||||||
Ok(json!({"result": "success"}).into())
|
Ok(json!({"result": "success"}).into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create new account
|
/* Create new account
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,19 +152,19 @@ async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
|
||||||
5. Email with initial pw is sent to user
|
5. Email with initial pw is sent to user
|
||||||
6. Account added to skynet-users (they are paid up)
|
6. Account added to skynet-users (they are paid up)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Join existing account to wolves
|
/* Join existing account to wolves
|
||||||
related to above
|
related to above
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Password reset via email
|
/* Password reset via email
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* script to pull in all active members from wolves
|
/* script to pull in all active members from wolves
|
||||||
update the groups
|
update the groups
|
||||||
check if there are any pending signups
|
check if there are any pending signups
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue