discourse/app/views/user_api_keys/new.html.erb
cfitz 19d7545318 FEATURE: Make auth_redirect param options on user_api_keys
This is a possible solution for https://meta.discourse.org/t/user-api-keys-specification/48536/19
This allows for user-api-key requests to not require a redirect url.
Instead, the encypted payload will just be displayed after creation  ( which can be copied
pasted into an env for a CLI, for example  )

Also: Show instructions when creating user-api-key w/out redirect

This adds a view to show instructions when requesting a user-api-key
without a redirect. It adds a erb template and json format.
Also adds a i18n user_api_key.instructions for server.en.yml
2019-01-04 14:46:18 +11:00

37 lines
1018 B
Plaintext

<h1><%= t "user_api_key.title" %></h1>
<div class='authorize-api-key'>
<% if @no_trust_level %>
<h3>
<%= t("user_api_key.no_trust_level") %>
</h3>
<% elsif @generic_error %>
<h3>
<%= t("user_api_key.generic_error") %>
</h3>
<% else %>
<p>
<%= t("user_api_key.description", application_name: @application_name) %>
</p>
<p>
<ul class='scopes'>
<%- @localized_scopes.each do |scope| %>
<li><%= scope %></li>
<%- end %>
</ul>
</p>
<%= form_tag(user_api_key_path) do %>
<%= hidden_field_tag 'application_name', @application_name %>
<%= hidden_field_tag 'access', @access %>
<%= hidden_field_tag 'nonce', @nonce %>
<%= hidden_field_tag 'client_id', @client_id %>
<%= hidden_field_tag('auth_redirect', @auth_redirect) if @auth_redirect %>
<%= hidden_field_tag 'push_url', @push_url %>
<%= hidden_field_tag 'public_key', @public_key%>
<%= hidden_field_tag 'scopes', @scopes%>
<%= submit_tag t('user_api_key.authorize'), class: 'btn btn-danger' %>
<% end %>
</div>
<% end %>