feat: not storing discord data in the ldap

This commit is contained in:
silver 2023-10-22 14:14:17 +01:00
parent 6cc97eccb2
commit a76c00b200

View file

@ -21,8 +21,6 @@ pub struct ModifyResult {
#[serde(rename = "sshPublicKey")] #[serde(rename = "sshPublicKey")]
ssh_public_key: Option<String>, ssh_public_key: Option<String>,
cn: Option<String>, cn: Option<String>,
#[serde(rename = "skDiscord")]
sk_discord: Option<String>,
} }
/// Handles updating a single field with the users own password /// Handles updating a single field with the users own password
@ -108,10 +106,7 @@ pub async fn submit(mut req: Request<State>) -> tide::Result {
ldap.unbind()?; ldap.unbind()?;
// if its mail or discord update the local db // if its mail update the local db
if &field == "skDiscord" {
update_local_db(db, "discord", &value).await.ok();
}
if &field == "mail" { if &field == "mail" {
update_local_db(db, "mail", &value).await.ok(); update_local_db(db, "mail", &value).await.ok();
} }
@ -123,8 +118,7 @@ fn get_result(ldap: &mut LdapConn, dn: &str) -> ModifyResult {
let mut result = ModifyResult { let mut result = ModifyResult {
mail: None, mail: None,
ssh_public_key: None, ssh_public_key: None,
cn: None, cn: None
sk_discord: None,
}; };
if let Ok(temp) = ldap.search(dn, Scope::Base, "(objectClass=*)", vec!["mail", "sshPublicKey", "cn", "skDiscord"]) { if let Ok(temp) = ldap.search(dn, Scope::Base, "(objectClass=*)", vec!["mail", "sshPublicKey", "cn", "skDiscord"]) {
@ -134,7 +128,6 @@ fn get_result(ldap: &mut LdapConn, dn: &str) -> ModifyResult {
result.mail = get_result_values(&tmp.attrs, "mail"); result.mail = get_result_values(&tmp.attrs, "mail");
result.ssh_public_key = get_result_values(&tmp.attrs, "sshPublicKey"); result.ssh_public_key = get_result_values(&tmp.attrs, "sshPublicKey");
result.cn = get_result_values(&tmp.attrs, "cn"); result.cn = get_result_values(&tmp.attrs, "cn");
result.sk_discord = get_result_values(&tmp.attrs, "skDiscord");
} }
} }
} }