From: lambda Date: Thu, 14 Jun 2018 07:14:18 +0000 (+0000) Subject: Merge branch 'bugfix/oauth2-param-name' into 'develop' X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=2c303b3302e28a85aec448a9d57f9c5b1e658bfb;p=akkoma Merge branch 'bugfix/oauth2-param-name' into 'develop' oauth: support either name or username parameter with grant_type=password Closes #180 See merge request pleroma/pleroma!219 --- 2c303b3302e28a85aec448a9d57f9c5b1e658bfb diff --cc lib/pleroma/web/oauth/oauth_controller.ex index 47962bbf8,cdfae8b6a..a5fb32a4e --- a/lib/pleroma/web/oauth/oauth_controller.ex +++ b/lib/pleroma/web/oauth/oauth_controller.ex @@@ -81,10 -81,10 +81,10 @@@ defmodule Pleroma.Web.OAuth.OAuthContro # - investigate a way to verify the user wants to grant read/write/follow once scope handling is done def token_exchange( conn, - %{"grant_type" => "password", "name" => name, "password" => password} = params + %{"grant_type" => "password", "username" => name, "password" => password} = params ) do with %App{} = app <- get_app_from_request(conn, params), - %User{} = user <- User.get_cached_by_nickname(name), + %User{} = user <- User.get_by_nickname_or_email(name), true <- Pbkdf2.checkpw(password, user.password_hash), {:ok, auth} <- Authorization.create_authorization(app, user), {:ok, token} <- Token.exchange_token(app, auth) do