Commit bdb5dd21 authored by Calv's avatar Calv
Browse files

Create action_fallback for username/password incorrect input

parent 103eca48
defmodule Pleroma.Web.OAuth.FallbackController do
use Pleroma.Web, :controller
alias Pleroma.Web.OAuth.OAuthController
# No user
def call(conn, nil) do
|> put_flash(:error, "Invalid Username/Password")
|> OAuthController.authorize(conn.params)
# No password
def call(conn, false) do
|> put_flash(:error, "Invalid Username/Password")
|> OAuthController.authorize(conn.params)
\ No newline at end of file
...@@ -5,6 +5,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do ...@@ -5,6 +5,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do
alias Pleroma.{Repo, User} alias Pleroma.{Repo, User}
alias Comeonin.Pbkdf2 alias Comeonin.Pbkdf2
plug :fetch_session
plug :fetch_flash
action_fallback Pleroma.Web.OAuth.FallbackController
def authorize(conn, params) do def authorize(conn, params) do
render conn, "show.html", %{ render conn, "show.html", %{
response_type: params["response_type"], response_type: params["response_type"],
<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> <h2>OAuth Authorization</h2>
<%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %> <%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %>
<%= label f, :name, "Name" %> <%= label f, :name, "Name" %>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment