mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-21 23:56:30 +00:00
Merge branch 'ldap-call' into 'develop'
LDAP: fix compile warning See merge request pleroma/pleroma!4270
This commit is contained in:
commit
6358294943
3 changed files with 6 additions and 1 deletions
0
changelog.d/ldap-warning.skip
Normal file
0
changelog.d/ldap-warning.skip
Normal file
|
@ -94,6 +94,10 @@ defmodule Pleroma.LDAP do
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bind_user(name, password) do
|
||||||
|
GenServer.call(__MODULE__, {:bind_user, name, password})
|
||||||
|
end
|
||||||
|
|
||||||
defp connect do
|
defp connect do
|
||||||
ldap = Config.get(:ldap, [])
|
ldap = Config.get(:ldap, [])
|
||||||
host = Keyword.get(ldap, :host, "localhost")
|
host = Keyword.get(ldap, :host, "localhost")
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
|
alias Pleroma.LDAP
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
|
||||||
import Pleroma.Web.Auth.Helpers, only: [fetch_credentials: 1]
|
import Pleroma.Web.Auth.Helpers, only: [fetch_credentials: 1]
|
||||||
|
@ -19,7 +20,7 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
def get_user(%Plug.Conn{} = conn) do
|
def get_user(%Plug.Conn{} = conn) do
|
||||||
with {:ldap, true} <- {:ldap, Pleroma.Config.get([:ldap, :enabled])},
|
with {:ldap, true} <- {:ldap, Pleroma.Config.get([:ldap, :enabled])},
|
||||||
{:ok, {name, password}} <- fetch_credentials(conn),
|
{:ok, {name, password}} <- fetch_credentials(conn),
|
||||||
%User{} = user <- GenServer.call(Pleroma.LDAP, {:bind_user, name, password}) do
|
%User{} = user <- LDAP.bind_user(name, password) do
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
else
|
else
|
||||||
{:ldap, _} ->
|
{:ldap, _} ->
|
||||||
|
|
Loading…
Reference in a new issue