Make the email attribute configurable

While here, fix the System.get_env usage to use the normal fallback value method and improve the UID label description
This commit is contained in:
Mark Felder 2024-09-17 13:36:46 -04:00
commit 363b462c54
3 changed files with 17 additions and 7 deletions

View file

@ -205,6 +205,8 @@ defmodule Pleroma.LDAP do
end
defp try_register(name, attributes) do
mail_attribute = Config.get([:ldap, :mail])
params = %{
name: name,
nickname: name,
@ -212,7 +214,7 @@ defmodule Pleroma.LDAP do
}
params =
case List.keyfind(attributes, ~c"mail", 0) do
case List.keyfind(attributes, to_charlist(mail_attribute), 0) do
{_, [mail]} -> Map.put_new(params, :email, :erlang.list_to_binary(mail))
_ -> params
end