ed4fb5ce76bf7afd1d47e8429061b365e7dd4a7f
[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 <%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %>
10
11 <%= if @params["registration"] in ["true", true] do %>
12 <h3>This is the first time you visit! Please enter your Pleroma handle.</h3>
13 <p>Choose carefully! You won't be able to change this later. You will be able to change your display name, though.</p>
14 <div class="input">
15 <%= label f, :nickname, "Pleroma Handle" %>
16 <%= text_input f, :nickname, placeholder: "lain" %>
17 </div>
18 <%= hidden_input f, :name, value: @params["name"] %>
19 <%= hidden_input f, :password, value: @params["password"] %>
20 <br>
21
22 <% else %>
23 <div class="input">
24 <%= label f, :name, "Username" %>
25 <%= text_input f, :name %>
26 </div>
27 <div class="input">
28 <%= label f, :password, "Password" %>
29 <%= password_input f, :password %>
30 </div>
31 <%= submit "Log In" %>
32 <div class="scopes-input">
33 <%= label f, :scope, "The following permissions will be granted" %>
34 <div class="scopes">
35 <%= for scope <- @available_scopes do %>
36 <%# Note: using hidden input with `unchecked_value` in order to distinguish user's empty selection from `scope` param being omitted %>
37 <%= if scope in @scopes do %>
38 <div class="scope">
39 <%= checkbox f, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
40 <%= label f, :"scope_#{scope}", String.capitalize(scope) %>
41 <%= if scope in @scopes && scope do %>
42 <%= String.capitalize(scope) %>
43 <% end %>
44 </div>
45 <% else %>
46 <%= checkbox f, :"scope_#{scope}", value: scope in @scopes && scope, checked_value: scope, unchecked_value: "", name: "authorization[scope][]" %>
47 <% end %>
48 <% end %>
49 </div>
50 </div>
51 <% end %>
52
53 <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
54
55 <%= hidden_input f, :client_id, value: @client_id %>
56 <%= hidden_input f, :response_type, value: @response_type %>
57 <%= hidden_input f, :redirect_uri, value: @redirect_uri %>
58 <%= hidden_input f, :state, value: @state %>
59
60 <%= if Pleroma.Config.oauth_consumer_enabled?() do %>
61 <%= render @view_module, Pleroma.Web.Auth.Authenticator.oauth_consumer_template(), assigns %>
62 <% end %>
63
64 <% end %>