diff --git a/plugins/oauth_provider/Gemfile b/plugins/oauth_provider/Gemfile
index ccaff8e..6909181 100644
--- a/plugins/oauth_provider/Gemfile
+++ b/plugins/oauth_provider/Gemfile
@@ -1 +1 @@
-gem 'doorkeeper', '~> 1.4.0'
+gem 'doorkeeper', '~> 3.1.0'
diff --git a/plugins/oauth_provider/controllers/doorkeeper/application_controller.rb b/plugins/oauth_provider/controllers/doorkeeper/application_controller.rb
index 75ac214..2017fb8 100644
--- a/plugins/oauth_provider/controllers/doorkeeper/application_controller.rb
+++ b/plugins/oauth_provider/controllers/doorkeeper/application_controller.rb
@@ -2,7 +2,6 @@ module Doorkeeper
class ApplicationController < ApplicationController
include Helpers::Controller
- helper 'doorkeeper/form_errors'
end
end
diff --git a/plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb b/plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb
index 637b2ed..4685f7c 100644
--- a/plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb
+++ b/plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb
@@ -1,6 +1,6 @@
class OauthProviderPluginPublicController < PublicController
- doorkeeper_for :me
+ before_action :doorkeeper_authorize!
def me
user = environment.users.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
diff --git a/plugins/oauth_provider/db/migrate/20160727164530_add_scopes_to_oauth_applications.rb b/plugins/oauth_provider/db/migrate/20160727164530_add_scopes_to_oauth_applications.rb
new file mode 100644
index 0000000..cd17551
--- /dev/null
+++ b/plugins/oauth_provider/db/migrate/20160727164530_add_scopes_to_oauth_applications.rb
@@ -0,0 +1,5 @@
+class AddScopesToOauthApplications < ActiveRecord::Migration
+ def change
+ add_column :oauth_applications, :scopes, :string, null: false, default: ''
+ end
+end
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb
index 0a407db..5303ad8 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb
@@ -1,5 +1,5 @@
<%- submit_btn_css ||= 'btn btn-link' %>
-<%= form_tag [:oauth, application] do %>
+<%= form_tag oauth_application_path(application) do %>
- <%= submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css %>
+ <%= submit_tag _('Destroy'), onclick: "return confirm('#{ _('Are you sure?') }')", class: submit_btn_css %>
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
index 7ea09dc..a1f8346 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
@@ -1,12 +1,11 @@
-<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %>
+<% extend Doorkeeper::DashboardHelper %>
+<%= form_for application, url: doorkeeper_submit_path(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 %>
- <%= f.label :name, class: 'col-sm-2 control-label', for: 'application_name' %>
+ <%= f.label :name, class: 'col-sm-2 control-label' %>
<%= f.text_field :name, class: 'form-control' %>
<%= doorkeeper_errors_for application, :name %>
@@ -14,26 +13,36 @@
<% end %>
<%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %>
- <%= f.label :redirect_uri, class: 'col-sm-2 control-label', for: 'application_redirect_uri' %>
+ <%= f.label :redirect_uri, class: 'col-sm-2 control-label' %>
<%= f.text_area :redirect_uri, class: 'form-control' %>
<%= doorkeeper_errors_for application, :redirect_uri %>
<%= _('Use one line per URI') %>
-
+
<% if Doorkeeper.configuration.native_redirect_uri %>
- Use <%= Doorkeeper.configuration.native_redirect_uri %>
for local tests
+ <%= raw _('Use %s to local tests') % "#{ Doorkeeper.configuration.native_redirect_uri }
" %>
<% end %>
<% end %>
+ <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:scopes].present?}" do %>
+ <%= f.label :scopes, class: 'col-sm-2 control-label' %>
+
+ <%= f.text_field :scopes, class: 'form-control' %>
+ <%= doorkeeper_errors_for application, :scopes %>
+
+ <%= _('Separate scopes with spaces. Leave blank to use the default scopes.') %>
+
+
+ <% end %>
+
<% end %>
-
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
index 2cc3631..6ce4642 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
@@ -1,6 +1,6 @@
<%= link_to _('New Application'), new_oauth_application_path, class: 'btn btn-success' %>
@@ -17,7 +17,7 @@
<% @applications.each do |application| %>
- <%= link_to application.name, [:oauth, application] %>
+ <%= link_to application.name, oauth_application_path(application) %>
<%= application.redirect_uri %>
<%= link_to _('Edit'), edit_oauth_application_path(application), class: 'btn btn-link' %>
<%= render 'delete_form', application: application %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/new.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/new.html.erb
index 68934dd..bb302d6 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/new.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/new.html.erb
@@ -1,5 +1,5 @@
<%= render 'form', application: @application %>
diff --git a/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
index 1a68133..db3a391 100644
--- a/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
@@ -5,13 +5,14 @@
<%= _('Application Id:') %>
-
<%= @application.uid %>
<%= _('Secret:') %>
-
<%= @application.secret %>
+
<%= _('Scopes') %>:
+
<%= @application.scopes %>
+
<%= _('Callback urls:') %>
@@ -21,6 +22,7 @@
<%= uri %>
+ <%= link_to _('Authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %>
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb
index d374a6c..60be506 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb
@@ -1,5 +1,5 @@
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
index 2c6455c..f604f79 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
@@ -1,21 +1,20 @@
-
- <%= _('Authorize %s to use your account?') % "#{@pre_auth.client.name} " %>
+ <%= _('Authorize %s to use your account?') % "#{@pre_auth.client.name} " %>
- <% if @pre_auth.scopes %>
+ <% if @pre_auth.scopes.count > 0 %>
<%= _('This application will be able to:') %>
<% @pre_auth.scopes.each do |scope| %>
- <%= OauthProviderPlugin::SCOPE_TRANSLATION[scope] %>
+ <%= t scope, scope: [:doorkeeper, :scopes] %>
<% end %>
@@ -28,7 +27,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_button :ok, _("Authorize") %>
+ <%= 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 %>
@@ -36,7 +35,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_button :cancel, _("Deny") %>
+ <%= submit_tag _('Deny'), class: "btn btn-danger btn-lg btn-block" %>
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb
index 2a47be1..cbb771d 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb
@@ -1,5 +1,5 @@
diff --git a/plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb b/plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb
index 92b5a61..cbb2d65 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb
@@ -1,5 +1,5 @@
<%- submit_btn_css ||= 'btn btn-link' %>
<%= form_tag oauth_authorized_application_path(application) do %>
- <%= submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: submit_btn_css %>
+ <%= submit_tag _('Revoke'), onclick: "return confirm('#{ _('Are you sure?') }')", class: submit_btn_css %>
<% end %>
diff --git a/plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb b/plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb
index 0b9a6c3..df03704 100644
--- a/plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb
+++ b/plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb
@@ -1,14 +1,14 @@
- Application
- Created At
+ <%= _('Application') %>
+ <%= _('Created at') %>
@@ -24,7 +24,6 @@
-
<%= button(:back, _('Go back'), :back) %>
--
libgit2 0.21.2