1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Auth.PleromaAuthenticator do
9 @behaviour Pleroma.Web.Auth.Authenticator
11 def get_user(%Plug.Conn{} = conn) do
12 %{"authorization" => %{"name" => name, "password" => password}} = conn.params
14 with {_, %User{} = user} <- {:user, User.get_by_nickname_or_email(name)},
15 {_, true} <- {:checkpw, Pbkdf2.checkpw(password, user.password_hash)} do
23 def handle_error(%Plug.Conn{} = _conn, error) do
27 def auth_template, do: nil