aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/oauth/oauth_controller.ex
diff options
context:
space:
mode:
authorlambda <lain@soykaf.club>2019-03-26 15:13:55 +0000
committerlambda <lain@soykaf.club>2019-03-26 15:13:55 +0000
commit9e3899bf36cea47560c5de1d4787125f6296a3b8 (patch)
tree6b64d0844f13f0a477a71e82f49dee2d4d802be0 /lib/pleroma/web/oauth/oauth_controller.ex
parent21ff78cd40820b6b5e56b78a08afddd04417937b (diff)
parentb0759f821b13caa5ac2c4462748dcf6530a2d693 (diff)
downloadpleroma-9e3899bf36cea47560c5de1d4787125f6296a3b8.tar.gz
Merge branch 'features/mastoapi/2.7.0-auth-error-messages' into 'develop'
Mastodon-based auth error messages. User#auth_active?/1 refactoring. See merge request pleroma/pleroma!978
Diffstat (limited to 'lib/pleroma/web/oauth/oauth_controller.ex')
-rw-r--r--lib/pleroma/web/oauth/oauth_controller.ex12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex
index d151efe9e..ebb3dd253 100644
--- a/lib/pleroma/web/oauth/oauth_controller.ex
+++ b/lib/pleroma/web/oauth/oauth_controller.ex
@@ -83,14 +83,18 @@ defmodule Pleroma.Web.OAuth.OAuthController do
end
else
{scopes_issue, _} when scopes_issue in [:unsupported_scopes, :missing_scopes] ->
+ # Per https://github.com/tootsuite/mastodon/blob/
+ # 51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L39
conn
- |> put_flash(:error, "Permissions not specified.")
+ |> put_flash(:error, "This action is outside the authorized scopes")
|> put_status(:unauthorized)
|> authorize(auth_params)
{:auth_active, false} ->
+ # Per https://github.com/tootsuite/mastodon/blob/
+ # 51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76
conn
- |> put_flash(:error, "Account confirmation pending.")
+ |> put_flash(:error, "Your login is missing a confirmed e-mail address")
|> put_status(:forbidden)
|> authorize(auth_params)
@@ -149,9 +153,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do
json(conn, response)
else
{:auth_active, false} ->
+ # Per https://github.com/tootsuite/mastodon/blob/
+ # 51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76
conn
|> put_status(:forbidden)
- |> json(%{error: "Account confirmation pending"})
+ |> json(%{error: "Your login is missing a confirmed e-mail address"})
_error ->
put_status(conn, 400)