Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85825593
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/web/auth/database_authenticator.ex b/lib/pleroma/web/auth/database_authenticator.ex
index 69024a4ba..02a16b634 100644
--- a/lib/pleroma/web/auth/database_authenticator.ex
+++ b/lib/pleroma/web/auth/database_authenticator.ex
@@ -1,14 +1,18 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Auth.DatabaseAuthenticator do
alias Pleroma.User
@implementation Pleroma.Config.get(
Pleroma.Web.Auth.DatabaseAuthenticator,
Pleroma.Web.Auth.PleromaDatabaseAuthenticator
)
@callback get_user(Plug.Conn.t()) :: {:ok, User.t()} | {:error, any()}
defdelegate get_user(plug), to: @implementation
@callback handle_error(Plug.Conn.t(), any()) :: any()
defdelegate handle_error(plug, error), to: @implementation
end
diff --git a/lib/pleroma/web/auth/pleroma_database_authenticator.ex b/lib/pleroma/web/auth/pleroma_database_authenticator.ex
index 79a8dcfce..39aa1a586 100644
--- a/lib/pleroma/web/auth/pleroma_database_authenticator.ex
+++ b/lib/pleroma/web/auth/pleroma_database_authenticator.ex
@@ -1,22 +1,26 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.Auth.PleromaDatabaseAuthenticator do
alias Pleroma.User
alias Comeonin.Pbkdf2
@behaviour Pleroma.Web.Auth.DatabaseAuthenticator
def get_user(%Plug.Conn{} = conn) do
%{"authorization" => %{"name" => name, "password" => password}} = conn.params
with {_, %User{} = user} <- {:user, User.get_by_nickname_or_email(name)},
{_, true} <- {:checkpw, Pbkdf2.checkpw(password, user.password_hash)} do
{:ok, user}
else
error ->
{:error, error}
end
end
def handle_error(%Plug.Conn{} = _conn, error) do
error
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Oct 30, 1:45 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1799135
Default Alt Text
(1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline