mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-27 06:56:35 +08:00
Two changes: - shows a more prominent warning when the "write" scope is requested - shows the application name when displaying the key <img width="600" alt="image" src="https://github.com/user-attachments/assets/79a6d906-532f-4f2d-bd7b-54bd70362728" /> <img width="600" alt="image" src="https://github.com/user-attachments/assets/08eec177-f43b-4280-8144-267b178bef7f" />
55 lines
2.2 KiB
Text
Vendored
55 lines
2.2 KiB
Text
Vendored
<div class='authorize-api-key'>
|
|
<h1><%= t("user_api_key.title", application_name: @application_name) %></h1>
|
|
<% if @no_trust_level %>
|
|
<p class="error-message"><%= t("user_api_key.no_trust_level") %></p>
|
|
<% elsif @generic_error %>
|
|
<p class="error-message"><%= t("user_api_key.generic_error") %></p>
|
|
<% else %>
|
|
|
|
<div class="authorize-api-key__user">
|
|
<span class="authorize-api-key__user-label"><%= t("user_api_key.logged_in_as") %></span>
|
|
<img class="avatar" src="<%= current_user.avatar_template.gsub("{size}", "24") %>" width="24" height="24" alt="">
|
|
<span class="authorize-api-key__username"><%= current_user.username %></span>
|
|
</div>
|
|
|
|
<div class="authorize-api-key__permissions">
|
|
<p class="authorize-api-key__permissions-header"><%= t("user_api_key.permissions_header", application_name: @application_name) %></p>
|
|
<ul class='authorize-api-key__scopes'>
|
|
<%- @localized_scopes.each do |scope| %>
|
|
<li><%= scope %></li>
|
|
<%- end %>
|
|
</ul>
|
|
</div>
|
|
|
|
<% if @scopes&.split(",")&.include?("write") %>
|
|
<div class='authorize-api-key__write-warning alert alert-warning'>
|
|
<p><%= t("user_api_key.write_scope_warning") %></p>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if @redirect_uri %>
|
|
<div class='authorize-api-key__redirect'>
|
|
<p class="authorize-api-key__redirect-url">
|
|
<%= t("user_api_key.redirect_warning") %>
|
|
<strong><%= @redirect_uri %></strong>
|
|
</p>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= 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 %>
|
|
<%= hidden_field_tag('padding', @padding) if @padding %>
|
|
<div class='authorize-api-key__buttons'>
|
|
<%= submit_tag t('user_api_key.authorize'), class: 'btn btn-primary' %>
|
|
<a href="/" class='btn btn-default'><%= t('user_api_key.deny') %></a>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|