commit: d16b6139299e47777c68eca819e75f85f71a8156
parent: ad90da07f5e70023a67f9652c047ce374821da14
Author: Roger Braun <rbraun@Bobble.local>
Date: Thu, 23 Nov 2017 12:06:14 +0100
MastodonUI login: Show error message on error.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git 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
@@ -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>