forked from AkkomaGang/akkoma
Merge branch 'develop' into 'develop'
action_fallback for OAuth Controller See merge request pleroma/pleroma!63
This commit is contained in:
commit
af854f7e01
3 changed files with 19 additions and 0 deletions
12
lib/pleroma/web/oauth/fallback_controller.ex
Normal file
12
lib/pleroma/web/oauth/fallback_controller.ex
Normal file
|
@ -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
|
|
@ -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"],
|
||||
|
|
|
@ -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" %>
|
||||
|
|
Loading…
Reference in a new issue