LDAP: Generate valid credentialId when there are password changes
This commit is contained in:
@@ -14,6 +14,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
|
||||
- Allow HTTP to be used for configuring the server.
|
||||
|
||||
## Fixed
|
||||
- LDAP: Generate valid `credentialId` when there are password changes.
|
||||
- TLS: Disable cipher suited option disables wrong ciphers.
|
||||
- DNS Updater:
|
||||
- BunnyDNS: Use subdomain as name of record instead of FQDN.
|
||||
|
||||
@@ -39,8 +39,10 @@ impl UserAccount {
|
||||
}) {
|
||||
credential.secret = password;
|
||||
} else {
|
||||
let credential_id = self.next_credential_id().into();
|
||||
self.credentials
|
||||
.push(Credential::Password(PasswordCredential {
|
||||
credential_id,
|
||||
secret: password,
|
||||
..Default::default()
|
||||
}));
|
||||
@@ -86,6 +88,21 @@ impl UserAccount {
|
||||
self.into_password_credential()
|
||||
.map(|credential| credential.secret)
|
||||
}
|
||||
|
||||
pub fn next_credential_id(&self) -> u64 {
|
||||
self.credentials
|
||||
.0
|
||||
.values()
|
||||
.map(|credential| match credential {
|
||||
Credential::Password(credential) => credential.credential_id.id() + 1,
|
||||
Credential::AppPassword(credential_properties)
|
||||
| Credential::ApiKey(credential_properties) => {
|
||||
credential_properties.credential_id.id() + 1
|
||||
}
|
||||
})
|
||||
.max()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Credential {
|
||||
|
||||
Reference in New Issue
Block a user