diff --git a/plugins/oauth_provider/lib/oauth_provider_plugin.rb b/plugins/oauth_provider/lib/oauth_provider_plugin.rb
index 6655461..a733c5d 100644
--- a/plugins/oauth_provider/lib/oauth_provider_plugin.rb
+++ b/plugins/oauth_provider/lib/oauth_provider_plugin.rb
@@ -9,18 +9,14 @@ class OauthProviderPlugin < Noosfero::Plugin
end
Doorkeeper.configure do
- # Change the ORM that doorkeeper will use.
- # Currently supported options are :active_record, :mongoid2, :mongoid3, :mongo_mapper
orm :active_record
- # This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
domain = Domain.find_by_name(request.host)
environment = domain ? domain.environment : Environment.default
environment.users.find_by_id(session[:user]) || redirect_to('/account/login')
end
- # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
admin_authenticator do
domain = Domain.find_by_name(request.host)
environment = domain ? domain.environment : Environment.default
@@ -31,77 +27,7 @@ class OauthProviderPlugin < Noosfero::Plugin
user
end
- # Authorization Code expiration time (default 10 minutes).
- # authorization_code_expires_in 10.minutes
-
- # Access token expiration time (default 2 hours).
- # If you want to disable expiration, set this to nil.
- # access_token_expires_in 2.hours
-
- # Reuse access token for the same resource owner within an application (disabled by default)
- # Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
- # reuse_access_token
-
- # Issue access tokens with refresh token (disabled by default)
- # use_refresh_token
-
- # Provide support for an owner to be assigned to each registered application (disabled by default)
- # Optional parameter :confirmation => true (default false) if you want to enforce ownership of
- # a registered application
- # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
- # enable_application_owner :confirmation => false
-
- # Define access token scopes for your provider
- # For more information go to
- # https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
- # default_scopes :public
- # optional_scopes :write, :update
-
- # Change the way client credentials are retrieved from the request object.
- # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
- # falls back to the `:client_id` and `:client_secret` params from the `params` object.
- # Check out the wiki for more information on customization
- # client_credentials :from_basic, :from_params
-
- # Change the way access token is authenticated from the request object.
- # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
- # falls back to the `:access_token` or `:bearer_token` params from the `params` object.
- # Check out the wiki for more information on customization
- # access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
-
- # Change the native redirect uri for client apps
- # When clients register with the following redirect uri, they won't be redirected to any server and the authorization code will be displayed within the provider
- # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
- # (Similar behaviour: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi)
- #
- # native_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
-
- # Specify what grant flows are enabled in array of Strings. The valid
- # strings and the flows they enable are:
- #
- # "authorization_code" => Authorization Code Grant Flow
- # "implicit" => Implicit Grant Flow
- # "password" => Resource Owner Password Credentials Grant Flow
- # "client_credentials" => Client Credentials Grant Flow
- #
- # If not specified, Doorkeeper enables all the four grant flows.
- #
- # grant_flows %w(authorization_code implicit password client_credentials)
-
- # Under some circumstances you might want to have applications auto-approved,
- # so that the user skips the authorization step.
- # For example if dealing with trusted a application.
- # skip_authorization do |resource_owner, client|
- # client.superapp? or resource_owner.admin?
- # end
-
- # WWW-Authenticate Realm (default "Doorkeeper").
- # realm "Doorkeeper"
-
- # Allow dynamic query parameters (disabled by default)
- # Some applications require dynamic query parameters on their request_uri
- # set to true if you want this to be allowed
- # wildcard_redirect_uri false
+ default_scopes :public
end
Rails.configuration.to_prepare do
@@ -117,4 +43,8 @@ class OauthProviderPlugin < Noosfero::Plugin
end
end
+ SCOPE_TRANSLATION = {
+ 'public' => _('Access your public data')
+ }
+
end
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
index 4654d72..7ea09dc 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
@@ -1,6 +1,8 @@
<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %>
<% if application.errors.any? %>
-
Whoops! Check your form for possible errors
+
+
<%= _('Whoops! Check your form for possible errors') %>
+
<% end %>
<%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %>
@@ -17,7 +19,7 @@
<%= f.text_area :redirect_uri, class: 'form-control' %>
<%= doorkeeper_errors_for application, :redirect_uri %>
- Use one line per URI
+ <%= _('Use one line per URI') %>
<% if Doorkeeper.configuration.native_redirect_uri %>
@@ -29,8 +31,8 @@
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb
index 06926ae..6fceb40 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb
@@ -1,5 +1,5 @@
<%= render 'form', application: @application %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
index 1584d31..9e20df0 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
@@ -1,14 +1,14 @@
-<%= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' %>
+<%= link_to _('New Application'), new_oauth_application_path, class: 'btn btn-success' %>
- Name |
- Callback URL |
+ <%= _('Name') %> |
+ <%= _('Callback URL') %> |
|
|
@@ -18,7 +18,7 @@
<%= link_to application.name, [:oauth, application] %> |
<%= application.redirect_uri %> |
- <%= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link' %> |
+ <%= link_to _('Edit'), edit_oauth_application_path(application), class: 'btn btn-link' %> |
<%= render 'delete_form', application: application %> |
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
index d3af6fc..1a68133 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
@@ -1,18 +1,18 @@
-
Application Id:
+
<%= _('Application Id:') %>
<%= @application.uid %>
-
Secret:
+
<%= _('Secret:') %>
<%= @application.secret %>
-
Callback urls:
+
<%= _('Callback urls:') %>
<% @application.redirect_uri.split.each do |uri| %>
@@ -21,7 +21,6 @@
<%= uri %>
- <%= link_to 'Authorize', oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %>
|
<% end %>
@@ -29,9 +28,12 @@
-
Actions
+
<%= _('Actions') %>
-
<%= link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary' %>
+
+ <%= link_to _('Edit'), edit_oauth_application_path(@application), class: 'btn btn-primary' %>
+ <%= link_to _("Cancel"), oauth_applications_path, :class => "btn btn-default" %>
+
<%= render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger' %>
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
index c6140c0..6be5fab 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
@@ -1,19 +1,19 @@
- Authorize <%= @pre_auth.client.name %> to use your account?
+ <%= _('Authorize %s to use your account?' % "#{@pre_auth.client.name}") %>
<% if @pre_auth.scopes %>
-
This application will be able to:
+
<%= _('This application will be able to:') %>
<% @pre_auth.scopes.each do |scope| %>
- - <%= t scope, scope: [:doorkeeper, :scopes] %>
+ - <%= OauthProviderPlugin::SCOPE_TRANSLATION[scope] %>
<% end %>
@@ -26,7 +26,7 @@
<%= hidden_field_tag :state, @pre_auth.state %>
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
<%= hidden_field_tag :scope, @pre_auth.scope %>
- <%= submit_tag "Authorize", class: "btn btn-success btn-lg btn-block" %>
+ <%= submit_tag _("Authorize"), class: "btn btn-success btn-lg btn-block" %>
<% end %>
<%= form_tag oauth_authorization_path, method: :delete do %>
<%= hidden_field_tag :client_id, @pre_auth.client.uid %>
@@ -34,7 +34,7 @@
<%= hidden_field_tag :state, @pre_auth.state %>
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
<%= hidden_field_tag :scope, @pre_auth.scope %>
- <%= submit_tag "Deny", class: "btn btn-danger btn-lg btn-block" %>
+ <%= submit_tag _("Deny"), class: "btn btn-danger btn-lg btn-block" %>
<% end %>
diff --git a/plugins/oauth_provider/views/oauth_provider_plugin_admin/index.html.erb b/plugins/oauth_provider/views/oauth_provider_plugin_admin/index.html.erb
index 5fa8720..7e11968 100644
--- a/plugins/oauth_provider/views/oauth_provider_plugin_admin/index.html.erb
+++ b/plugins/oauth_provider/views/oauth_provider_plugin_admin/index.html.erb
@@ -1,5 +1,5 @@
-
<%= _('Oauh Provider') %>
+
<%= _('Oauh Provider') %>
<%= link_to _('Applications'), oauth_applications_path %>
--
libgit2 0.21.2