aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Braun <rbraun@Bobble.local>2017-11-23 12:06:14 +0100
committerRoger Braun <rbraun@Bobble.local>2017-11-23 12:06:14 +0100
commitd16b6139299e47777c68eca819e75f85f71a8156 (patch)
tree2b2a0ad6db8af51436e31886ced9772c83872777
parentad90da07f5e70023a67f9652c047ce374821da14 (diff)
downloadpleroma-d16b6139299e47777c68eca819e75f85f71a8156.tar.gz
MastodonUI login: Show error message on error.
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex6
-rw-r--r--lib/pleroma/web/templates/mastodon_api/mastodon/login.html.eex3
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index fc7f21096..82887966c 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -559,7 +559,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def login(conn, _) do
conn
- |> render(MastodonView, "login.html")
+ |> render(MastodonView, "login.html", %{error: false})
end
defp get_or_make_app() do
@@ -581,6 +581,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
conn
|> put_session(:oauth_token, token.token)
|> redirect(to: "/web/getting-started")
+ else
+ _e ->
+ conn
+ |> render(MastodonView, "login.html", %{error: "Wrong username or password"})
end
end
diff --git a/lib/pleroma/web/templates/mastodon_api/mastodon/login.html.eex b/lib/pleroma/web/templates/mastodon_api/mastodon/login.html.eex
index 89d97561b..2ef67b901 100644
--- a/lib/pleroma/web/templates/mastodon_api/mastodon/login.html.eex
+++ b/lib/pleroma/web/templates/mastodon_api/mastodon/login.html.eex
@@ -1,4 +1,7 @@
<h2>Login in to Mastodon Frontend</h2>
+<%= if @error do %>
+ <h2><%= @error %></h2>
+<% end %>
<%= form_for @conn, mastodon_api_path(@conn, :login), [as: "authorization"], fn f -> %>
<%= text_input f, :name, placeholder: "Username" %>
<br>