logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: af854f7e01efa24d57b68283a9884d3fc80d6438
parent: f0cde24f71f292b417dfcac663e1f4e6082c833a
Author: lambda <pleromagit@rogerbraun.net>
Date:   Fri,  9 Feb 2018 08:57:54 +0000

Merge branch 'develop' into 'develop'

action_fallback for OAuth Controller

See merge request pleroma/pleroma!63

Diffstat:

Alib/pleroma/web/oauth/fallback_controller.ex13+++++++++++++
Mlib/pleroma/web/oauth/oauth_controller.ex5+++++
Mlib/pleroma/web/templates/o_auth/o_auth/show.html.eex2++
3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/lib/pleroma/web/oauth/fallback_controller.ex b/lib/pleroma/web/oauth/fallback_controller.ex @@ -0,0 +1,12 @@ +defmodule Pleroma.Web.OAuth.FallbackController do + use Pleroma.Web, :controller + alias Pleroma.Web.OAuth.OAuthController + + # No user/password + def call(conn, _) do + conn + |> put_flash(:error, "Invalid Username/Password") + |> OAuthController.authorize(conn.params) + end + +end+ \ No newline at end of file diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex @@ -5,6 +5,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do alias Pleroma.{Repo, User} alias Comeonin.Pbkdf2 + plug :fetch_session + plug :fetch_flash + + action_fallback Pleroma.Web.OAuth.FallbackController + def authorize(conn, params) do render conn, "show.html", %{ response_type: params["response_type"], diff --git a/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex b/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex @@ -1,3 +1,5 @@ +<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p> +<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p> <h2>OAuth Authorization</h2> <%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %> <%= label f, :name, "Name" %>