AP refactoring.

This commit is contained in:
Roger Braun 2017-05-16 15:31:11 +02:00
commit 70024632ba
12 changed files with 334 additions and 247 deletions

View file

@ -1,11 +1,14 @@
defmodule Pleroma.Plugs.AuthenticationPlug do
alias Comeonin.Pbkdf2
import Plug.Conn
alias Pleroma.User
def init(options) do
options
end
def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
def call(conn, opts) do
with {:ok, username, password} <- decode_header(conn),
{:ok, user} <- opts[:fetcher].(username),