aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/oauth/oauth_controller.ex
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-03-15 19:57:09 +0000
committerkaniini <nenolod@gmail.com>2019-03-15 19:57:09 +0000
commit8b352af4dd4f79432e3e9c48593380292e4002d7 (patch)
tree095ae99a4174942d170b14578a9e079077befb1d /lib/pleroma/web/oauth/oauth_controller.ex
parentacf215d983f7a57fb8375184e24d2e04eda74eb5 (diff)
parenta070dd4a83788dfd76809d8b4ee4111b05cdff47 (diff)
downloadpleroma-8b352af4dd4f79432e3e9c48593380292e4002d7.tar.gz
Merge branch 'feature/openldap-support' into 'develop'
OpenLDAP support Closes #203 See merge request pleroma/pleroma!859
Diffstat (limited to 'lib/pleroma/web/oauth/oauth_controller.ex')
-rw-r--r--lib/pleroma/web/oauth/oauth_controller.ex8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex
index ec70b7ccc..d69383d40 100644
--- a/lib/pleroma/web/oauth/oauth_controller.ex
+++ b/lib/pleroma/web/oauth/oauth_controller.ex
@@ -5,7 +5,6 @@
defmodule Pleroma.Web.OAuth.OAuthController do
use Pleroma.Web, :controller
- alias Comeonin.Pbkdf2
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.Auth.Authenticator
@@ -126,11 +125,10 @@ defmodule Pleroma.Web.OAuth.OAuthController do
def token_exchange(
conn,
- %{"grant_type" => "password", "username" => name, "password" => password} = params
+ %{"grant_type" => "password"} = params
) do
- with %App{} = app <- get_app_from_request(conn, params),
- %User{} = user <- User.get_by_nickname_or_email(name),
- true <- Pbkdf2.checkpw(password, user.password_hash),
+ with {_, {:ok, %User{} = user}} <- {:get_user, Authenticator.get_user(conn)},
+ %App{} = app <- get_app_from_request(conn, params),
{:auth_active, true} <- {:auth_active, User.auth_active?(user)},
scopes <- oauth_scopes(params, app.scopes),
[] <- scopes -- app.scopes,