Closed cn-hew closed 2 months ago
FYI: I'll be mostly offline for the next ten days or so, and I won't be able to handle any issues.
How should I change the user's password? I haven't seen any corresponding examples.
It depends on the server you're talking to and the configuration of the whole environment. Because of that, I consider this a usage question, and not a documentation issue. So, what type of server is it, in case I'm familiar with it?
Hi, thanks for your reply, I have solved my problem, the code is as follows
pub async fn modify_user_password(&mut self,dn:String,password:String) -> Result<LdapResult> {
let attr_name = String::from("unicodePwd").into_bytes();
let values: Vec<u8> = format!("\"{}\"",password).encode_utf16().flat_map(|v|v.to_le_bytes()).collect();
let mut passwd = HashSet::new();
passwd.insert(values);
let mods = vec![
Mod::Replace(attr_name,passwd)
];
let result = self.ldap.modify(&dn, mods).await.unwrap();
return Ok(result)
}
Hi, How should I change the user's password? I haven't seen any corresponding examples. My existing code can refer to #130 Thanks for any reply.