Merge remote-tracking branch 'upstream/pull/3177'

This commit is contained in:
Tom Hughes 2021-06-24 08:43:18 +01:00
commit 8d76be71bb
41 changed files with 1859 additions and 34 deletions

View file

@ -0,0 +1,23 @@
<tr>
<td class="align-middle">
<ul class="list-unstyled mb-0">
<li><%= link_to application.name, oauth_application_path(application) %></li>
<% application.redirect_uri.split.each do |uri| -%>
<li class="text-muted"><%= uri %></li>
<% end -%>
</ul>
</td>
<td class="align-middle">
<ul class="list-unstyled mb-0">
<% application.scopes.each do |scope| -%>
<li><%= t "oauth.scopes.#{scope}" %> <code class="text-muted">(<%= scope %>)</code></li>
<% end -%>
</ul>
</td>
<td class="align-middle">
<%= link_to t(".edit"), edit_oauth_application_path(application), :class => "btn btn-outline-primary" %>
</td>
<td class="align-middle">
<%= link_to t(".delete"), oauth_application_path(application), { :method => :delete, :class => "btn btn-outline-danger", :data => { :confirm => t(".confirm_delete") } } %>
</td>
</tr>

View file

@ -0,0 +1,7 @@
<%= f.text_field :name %>
<%= f.text_area :redirect_uri %>
<%= f.form_group :confidential do %>
<%= f.check_box :confidential %>
<% end %>
<%= f.collection_check_boxes :scopes, Oauth.scopes, :name, :description %>
<%= f.primary %>

View file

@ -0,0 +1,7 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<%= bootstrap_form_for @application, :url => oauth_application_path(@application), :html => { :method => :put } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>

View file

@ -0,0 +1,23 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<% if @applications.length > 0 %>
<table class="table table-borderless table-striped">
<thead>
<th><%= t ".name" %></th>
<th><%= t ".permissions" %></th>
<th></th>
<th></th>
</thead>
<tbody>
<%= render :partial => "application", :collection => @applications %>
</tbody>
</table>
<% else %>
<p><%= t ".no_applications_html", :oauth2 => link_to(t(".oauth_2"), "https://oauth.net/2/") %></p>
<% end %>
<p>
<%= link_to t(".new"), new_oauth_application_path, :class => "btn btn-outline-primary" %>
</p>

View file

@ -0,0 +1,7 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<%= bootstrap_form_for @application, :url => { :action => :create } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>

View file

@ -0,0 +1 @@
<p><%= t ".sorry" %></p>

View file

@ -0,0 +1,49 @@
<% content_for :heading do %>
<h1><%= @application.name %></h1>
<% end %>
<% secret = flash[:application_secret].presence || @application.plaintext_secret %>
<table class="table table-borderless">
<tr>
<th><%= t ".client_id" %></th>
<td><code><%= @application.uid %></code></td>
</tr>
<% unless secret.blank? && Doorkeeper.config.application_secret_hashed? -%>
<tr>
<th><%= t ".client_secret" %></th>
<td>
<code><%= secret %></code>
<% if Doorkeeper.config.application_secret_hashed? -%>
<br />
<small class="text-danger"><%= t ".client_secret_warning" %></small>
<% end -%>
</td>
</tr>
<% end -%>
<tr>
<th><%= t ".permissions" %></th>
<td>
<ul class="list-unstyled mb-0">
<% @application.scopes.each do |scope| -%>
<li><%= t "oauth.scopes.#{scope}" %> <code class="text-muted">(<%= scope %>)</code></li>
<% end -%>
</ul>
</td>
</tr>
<tr>
<th><%= t ".redirect_uris" %></th>
<td>
<ul class="list-unstyled mb-0">
<% @application.redirect_uri.split.each do |uri| -%>
<li><%= uri %></li>
<% end -%>
</ul>
</td>
</tr>
</table>
<div>
<%= link_to t(".edit"), edit_oauth_application_path(@application), :class => "btn btn-outline-primary" %>
<%= link_to t(".delete"), oauth_application_path(@application), { :method => :delete, :class => "btn btn-outline-danger", :data => { :confirm => t(".confirm_delete") } } %>
</td>

View file

@ -0,0 +1,5 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<p><%= @pre_auth.error_response.body[:error_description] %></p>

View file

@ -0,0 +1,38 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<p><%= t ".introduction", :application => @pre_auth.client.name %></p>
<ul>
<% @pre_auth.scopes.each do |scope| -%>
<li><%= t "oauth.scopes.#{scope}" %></li>
<% end -%>
</ul>
<div class="row justify-content-start no-gutters mx-n1">
<div class="col-auto mx-1">
<%= bootstrap_form_tag :action => :create do |f| %>
<%= f.hidden_field :client_id, :value => @pre_auth.client.uid %>
<%= f.hidden_field :redirect_uri, :value => @pre_auth.redirect_uri %>
<%= f.hidden_field :state, :value => @pre_auth.state %>
<%= f.hidden_field :response_type, :value => @pre_auth.response_type %>
<%= f.hidden_field :scope, :value => @pre_auth.scope %>
<%= f.hidden_field :code_challenge, :value => @pre_auth.code_challenge %>
<%= f.hidden_field :code_challenge_method, :value => @pre_auth.code_challenge_method %>
<%= f.primary t(".authorize") %>
<% end %>
</div>
<div class="col-auto mx-1">
<%= bootstrap_form_tag :action => :destroy, :html => { :method => :delete } do |f| %>
<%= f.hidden_field :client_id, :value => @pre_auth.client.uid %>
<%= f.hidden_field :redirect_uri, :value => @pre_auth.redirect_uri %>
<%= f.hidden_field :state, :value => @pre_auth.state %>
<%= f.hidden_field :response_type, :value => @pre_auth.response_type %>
<%= f.hidden_field :scope, :value => @pre_auth.scope %>
<%= f.hidden_field :code_challenge, :value => @pre_auth.code_challenge %>
<%= f.hidden_field :code_challenge_method, :value => @pre_auth.code_challenge_method %>
<%= f.submit t(".deny") %>
<% end %>
</div>
</div>

View file

@ -0,0 +1,5 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<code id="authorization_code"><%= params[:code] %></code>

View file

@ -0,0 +1,15 @@
<tr>
<td class="align-middle">
<%= link_to application.name, oauth_application_path(application) %>
</td>
<td class="align-middle">
<ul class="list-unstyled mb-0">
<% application.scopes.each do |scope| -%>
<li><%= t "oauth.scopes.#{scope}" %></li>
<% end -%>
</ul>
</td>
<td class="align-middle text-right">
<%= link_to t(".revoke"), oauth_authorized_application_path(application), { :method => :delete, :class => "btn btn-outline-danger", :data => { :confirm => t(".confirm_revoke") } } %>
</td>
</tr>

View file

@ -0,0 +1,18 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<% if @applications.length > 0 %>
<table class="table table-borderless table-striped">
<thead>
<th><%= t ".application" %></th>
<th><%= t ".permissions" %></th>
<th></th>
</thead>
<tbody>
<%= render :partial => "application", :collection => @applications %>
</tbody>
</table>
<% else %>
<p><%= t ".no_applications_html", :oauth2 => link_to(t(".oauth_2"), "https://oauth.net/2/") %></p>
<% end %>

View file

@ -6,7 +6,9 @@
<h1><%= t ".my settings" %></h1>
<ul class='secondary-actions clearfix'>
<li><%= link_to t(".return to profile"), user_path(current_user) %></li>
<li><%= link_to t("users.show.oauth settings"), :controller => "oauth_clients", :action => "index" %></li>
<li><%= link_to t(".oauth1 settings"), oauth_clients_path %></li>
<li><%= link_to t(".oauth2 applications"), oauth_applications_path %></li>
<li><%= link_to t(".oauth2 authorizations"), oauth_authorized_applications_path %></li>
</ul>
<% end %>