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

This commit is contained in:
Tom Hughes 2018-04-25 17:38:35 +01:00
commit 00425c8fca
5 changed files with 15 additions and 15 deletions

View file

@ -30,7 +30,7 @@ class OauthController < ApplicationController
@token = current_user.oauth_tokens.find_by :token => params[:token] @token = current_user.oauth_tokens.find_by :token => params[:token]
if @token if @token
@token.invalidate! @token.invalidate!
flash[:notice] = t("oauth.revoke.flash", :application => @token.client_application.name) flash[:notice] = t(".flash", :application => @token.client_application.name)
end end
redirect_to oauth_clients_url(:display_name => @token.user.display_name) redirect_to oauth_clients_url(:display_name => @token.user.display_name)
end end
@ -41,7 +41,7 @@ class OauthController < ApplicationController
append_content_security_policy_directives(:form_action => %w[*]) append_content_security_policy_directives(:form_action => %w[*])
if @token.invalidated? if @token.invalidated?
@message = t "oauth.oauthorize_failure.invalid" @message = t "oauth.authorize_failure.invalid"
render :action => "authorize_failure" render :action => "authorize_failure"
elsif request.post? elsif request.post?
if user_authorizes_token? if user_authorizes_token?
@ -69,7 +69,7 @@ class OauthController < ApplicationController
end end
else else
@token.invalidate! @token.invalidate!
@message = t("oauth.oauthorize_failure.denied", :app_name => @token.client_application.name) @message = t("oauth.authorize_failure.denied", :app_name => @token.client_application.name)
render :action => "authorize_failure" render :action => "authorize_failure"
end end
end end

View file

@ -1,19 +1,19 @@
<% content_for :heading do %> <% content_for :heading do %>
<h1><%= t "oauth.oauthorize.title" %></h1> <h1><%= t ".title" %></h1>
<% end %> <% end %>
<p><%= raw t("oauth.oauthorize.request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(current_user.display_name, :controller => :user, :action => :view, :display_name => current_user.display_name)) %></p> <p><%= raw t(".request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(current_user.display_name, :controller => :user, :action => :view, :display_name => current_user.display_name)) %></p>
<%= form_tag authorize_url do %> <%= form_tag authorize_url do %>
<%= hidden_field_tag "oauth_token", @token.token %> <%= hidden_field_tag "oauth_token", @token.token %>
<%- if params[:oauth_callback] -%> <%- if params[:oauth_callback] -%>
<%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %>
<%- end -%> <%- end -%>
<p><%= t 'oauth.oauthorize.allow_to' %></p> <p><%= t '.allow_to' %></p>
<ul> <ul>
<% @token.client_application.permissions.each do |perm| %> <% @token.client_application.permissions.each do |perm| %>
<li><%= check_box_tag perm.to_s, "yes", @token.read_attribute(perm) %><%= t "oauth.oauthorize.#{perm}" %></li> <li><%= check_box_tag perm.to_s, "yes", @token.read_attribute(perm) %><%= t ".#{perm}" %></li>
<% end %> <% end %>
</ul> </ul>
<p><%= submit_tag t("oauth.oauthorize.grant_access") %></p> <p><%= submit_tag t(".grant_access") %></p>
<% end %> <% end %>

View file

@ -1,5 +1,5 @@
<% content_for :heading do %> <% content_for :heading do %>
<h1><%= t "oauth.oauthorize_failure.title" %></h1> <h1><%= t ".title" %></h1>
<% end %> <% end %>
<p><%= @message %></p> <p><%= @message %></p>

View file

@ -1,9 +1,9 @@
<% content_for :heading do %> <% content_for :heading do %>
<h1><%= t "oauth.oauthorize_success.title" %></h1> <h1><%= t ".title" %></h1>
<% end %> <% end %>
<p><%= raw t("oauth.oauthorize_success.allowed", :app_name => link_to(@token.client_application.name, @token.client_application.url)) %></p> <p><%= raw t(".allowed", :app_name => link_to(@token.client_application.name, @token.client_application.url)) %></p>
<% if @token.oob? and not @token.oauth10? %> <% if @token.oob? and not @token.oauth10? %>
<p><%= t "oauth.oauthorize_success.verification", :code => @token.verifier %></p> <p><%= t ".verification", :code => @token.verifier %></p>
<% end %> <% end %>

View file

@ -1690,7 +1690,7 @@ en:
blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more." blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more."
need_to_see_terms: "Your access to the API is temporarily suspended. Please log-in to the web interface to view the Contributor Terms. You do not need to agree, but you must view them." need_to_see_terms: "Your access to the API is temporarily suspended. Please log-in to the web interface to view the Contributor Terms. You do not need to agree, but you must view them."
oauth: oauth:
oauthorize: authorize:
title: "Authorize access to your account" title: "Authorize access to your account"
request_access: "The application %{app_name} is requesting access to your account, %{user}. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like." request_access: "The application %{app_name} is requesting access to your account, %{user}. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like."
allow_to: "Allow the client application to:" allow_to: "Allow the client application to:"
@ -1702,11 +1702,11 @@ en:
allow_write_gpx: "upload GPS traces." allow_write_gpx: "upload GPS traces."
allow_write_notes: "modify notes." allow_write_notes: "modify notes."
grant_access: "Grant Access" grant_access: "Grant Access"
oauthorize_success: authorize_success:
title: "Authorization request allowed" title: "Authorization request allowed"
allowed: "You have granted application %{app_name} access to your account." allowed: "You have granted application %{app_name} access to your account."
verification: "The verification code is %{code}." verification: "The verification code is %{code}."
oauthorize_failure: authorize_failure:
title: "Authorization request failed" title: "Authorization request failed"
denied: "You have denied application %{app_name} access to your account." denied: "You have denied application %{app_name} access to your account."
invalid: "The authorization token is not valid." invalid: "The authorization token is not valid."