X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fauth%2Fldap_authenticator.ex;h=51a0f0fa2f78122eeec9df85c55cf7347662ae9f;hb=26b63540953f6a65bb52531b434fd6ab85aaedfe;hp=88217aab84dd533e632c2818bd823d706efcdcb7;hpb=6d6f48d0795cc12d3c5aca5d90ae51b10086996d;p=akkoma diff --git a/lib/pleroma/web/auth/ldap_authenticator.ex b/lib/pleroma/web/auth/ldap_authenticator.ex index 88217aab8..51a0f0fa2 100644 --- a/lib/pleroma/web/auth/ldap_authenticator.ex +++ b/lib/pleroma/web/auth/ldap_authenticator.ex @@ -12,10 +12,10 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do @connection_timeout 10_000 @search_timeout 10_000 - def get_user(%Plug.Conn{} = conn) do + def get_user(%Plug.Conn{} = conn, params) do if Pleroma.Config.get([:ldap, :enabled]) do {name, password} = - case conn.params do + case params do %{"authorization" => %{"name" => name, "password" => password}} -> {name, password} @@ -29,17 +29,19 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do {:error, {:ldap_connection_error, _}} -> # When LDAP is unavailable, try default authenticator - Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn) + Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn, params) error -> error end else # Fall back to default authenticator - Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn) + Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn, params) end end + def get_by_external_registration(conn, params), do: get_user(conn, params) + def handle_error(%Plug.Conn{} = _conn, error) do error end