def login(conn, _) do
conn
- |> render(MastodonView, "login.html")
+ |> render(MastodonView, "login.html", %{error: false})
end
defp get_or_make_app() 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
<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>