Skip to content

Commit

Permalink
[enh] Don't use list anymore for ldap upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
zamentur committed Jan 27, 2025
1 parent 63c1cd2 commit fbbbc08
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ def portal_update(
lastname = (
" ".join(fullname.split()[1:]) or " "
) # Stupid hack because LDAP requires the sn/lastname attr, but it accepts a single whitespace...
new_attr_dict["givenName"] = [firstname] # TODO: Validate
new_attr_dict["sn"] = [lastname] # TODO: Validate
new_attr_dict["cn"] = new_attr_dict["displayName"] = [
(firstname + " " + lastname).strip()
]
new_attr_dict["givenName"] = firstname # TODO: Validate
new_attr_dict["sn"] = lastname # TODO: Validate
new_attr_dict["cn"] = new_attr_dict["displayName"] = (
firstname + " " + lastname
).strip()

if mailalias is not None:
mailalias = [mail.strip() for mail in mailalias if mail and mail.strip()]
Expand Down Expand Up @@ -248,7 +248,7 @@ def portal_update(
except YunohostValidationError as e:
raise YunohostValidationError(e.key, path="newpassword")

new_attr_dict["userPassword"] = [_hash_user_password(newpassword)]
new_attr_dict["userPassword"] = _hash_user_password(newpassword)

# Check that current password is valid
# To be able to edit the user info, an authenticated ldap session is needed
Expand Down Expand Up @@ -278,7 +278,7 @@ def portal_update(
# be run as root
if all(field is not None for field in (fullname, mailalias, mailforward)):
return {
"fullname": new_attr_dict["cn"][0],
"fullname": new_attr_dict["cn"],
"mailalias": new_attr_dict["mail"][1:],
"mailforward": new_attr_dict["maildrop"][1:],
}
Expand Down

0 comments on commit fbbbc08

Please sign in to comment.