[#923] Support for multiple OAuth consumer strategies.
[akkoma] / lib / pleroma / web / templates / o_auth / o_auth / show.html.eex
1 <%= if get_flash(@conn, :info) do %>
2 <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
3 <% end %>
4 <%= if get_flash(@conn, :error) do %>
5 <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
6 <% end %>
7
8 <h2>OAuth Authorization</h2>
9
10 <%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %>
11 <div class="input">
12 <%= label f, :name, "Name or email" %>
13 <%= text_input f, :name %>
14 </div>
15 <div class="input">
16 <%= label f, :password, "Password" %>
17 <%= password_input f, :password %>
18 </div>
19 <div class="scopes-input">
20 <%= label f, :scope, "Permissions" %>
21 <div class="scopes">
22 <%= for scope <- @available_scopes do %>
23 <%# Note: using hidden input with `unchecked_value` in order to distinguish user's empty selection from `scope` param being omitted %>
24 <div class="scope">
25 <%= checkbox f, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
26 <%= label f, :"scope_#{scope}", String.capitalize(scope) %>
27 </div>
28 <% end %>
29 </div>
30 </div>
31
32 <%= hidden_input f, :client_id, value: @client_id %>
33 <%= hidden_input f, :response_type, value: @response_type %>
34 <%= hidden_input f, :redirect_uri, value: @redirect_uri %>
35 <%= hidden_input f, :state, value: @state%>
36 <%= submit "Authorize" %>
37 <% end %>
38
39 <%= if Pleroma.Config.get([:auth, :oauth_consumer_enabled]) do %>
40 <%= render @view_module, "consumer.html", assigns %>
41 <% end %>