Commit 4652d2026685bce0be557514f6b740b0c11f3195
1 parent
c1007e42
Exists in
fix_sign_up_form
oauth_provider: upgrade to doorkeper 3.1.0
Showing
14 changed files
with
46 additions
and
33 deletions
Show diff stats
plugins/oauth_provider/Gemfile
plugins/oauth_provider/controllers/doorkeeper/application_controller.rb
plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb
plugins/oauth_provider/db/migrate/20160727164530_add_scopes_to_oauth_applications.rb
0 → 100644
plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb
1 | 1 | <%- submit_btn_css ||= 'btn btn-link' %> |
2 | -<%= form_tag [:oauth, application] do %> | |
2 | +<%= form_tag oauth_application_path(application) do %> | |
3 | 3 | <input type="hidden" name="_method" value="delete"> |
4 | - <%= submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css %> | |
4 | + <%= submit_tag _('Destroy'), onclick: "return confirm('#{ _('Are you sure?') }')", class: submit_btn_css %> | |
5 | 5 | <% end %> | ... | ... |
plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb
1 | -<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %> | |
1 | +<% extend Doorkeeper::DashboardHelper %> | |
2 | +<%= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f| %> | |
2 | 3 | <% if application.errors.any? %> |
3 | - <div class="alert alert-danger" data-alert> | |
4 | - <p><%= _('Whoops! Check your form for possible errors') %></p> | |
5 | - </div> | |
4 | + <div class="alert alert-danger" data-alert><p><%= _('Whoops! Check your form for possible errors') %></p></div> | |
6 | 5 | <% end %> |
7 | 6 | |
8 | 7 | <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %> |
9 | - <%= f.label :name, class: 'col-sm-2 control-label', for: 'application_name' %> | |
8 | + <%= f.label :name, class: 'col-sm-2 control-label' %> | |
10 | 9 | <div class="col-sm-10"> |
11 | 10 | <%= f.text_field :name, class: 'form-control' %> |
12 | 11 | <%= doorkeeper_errors_for application, :name %> |
... | ... | @@ -14,26 +13,36 @@ |
14 | 13 | <% end %> |
15 | 14 | |
16 | 15 | <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %> |
17 | - <%= f.label :redirect_uri, class: 'col-sm-2 control-label', for: 'application_redirect_uri' %> | |
16 | + <%= f.label :redirect_uri, class: 'col-sm-2 control-label' %> | |
18 | 17 | <div class="col-sm-10"> |
19 | 18 | <%= f.text_area :redirect_uri, class: 'form-control' %> |
20 | 19 | <%= doorkeeper_errors_for application, :redirect_uri %> |
21 | 20 | <span class="help-block"> |
22 | 21 | <%= _('Use one line per URI') %> |
23 | - </span> | |
22 | + </span> | |
24 | 23 | <% if Doorkeeper.configuration.native_redirect_uri %> |
25 | 24 | <span class="help-block"> |
26 | - Use <code><%= Doorkeeper.configuration.native_redirect_uri %></code> for local tests | |
25 | + <%= raw _('Use %s to local tests') % "<code>#{ Doorkeeper.configuration.native_redirect_uri }</code>" %> | |
27 | 26 | </span> |
28 | 27 | <% end %> |
29 | 28 | </div> |
30 | 29 | <% end %> |
31 | 30 | |
31 | + <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:scopes].present?}" do %> | |
32 | + <%= f.label :scopes, class: 'col-sm-2 control-label' %> | |
33 | + <div class="col-sm-10"> | |
34 | + <%= f.text_field :scopes, class: 'form-control' %> | |
35 | + <%= doorkeeper_errors_for application, :scopes %> | |
36 | + <span class="help-block"> | |
37 | + <%= _('Separate scopes with spaces. Leave blank to use the default scopes.') %> | |
38 | + </span> | |
39 | + </div> | |
40 | + <% end %> | |
41 | + | |
32 | 42 | <div class="form-group"> |
33 | 43 | <div class="col-sm-offset-2 col-sm-10"> |
34 | 44 | <%= f.submit _('Submit'), class: "btn btn-primary" %> |
35 | - <%= link_to _("Cancel"), oauth_applications_path, :class => "btn btn-default" %> | |
45 | + <%= link_to _('Cancel'), oauth_applications_path, :class => "btn btn-default" %> | |
36 | 46 | </div> |
37 | 47 | </div> |
38 | 48 | <% end %> |
39 | - | ... | ... |
plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
1 | 1 | <div class="oauth-provider"> |
2 | 2 | <div class="page-header"> |
3 | - <h3><%= link_to _('Oauh Provider'), '/admin/plugin/oauth_provider' %></h3> | |
3 | + <h1><%= _('Oauh Provider') %></h1> | |
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <p><%= link_to _('New Application'), new_oauth_application_path, class: 'btn btn-success' %></p> |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | <tbody> |
18 | 18 | <% @applications.each do |application| %> |
19 | 19 | <tr id="application_<%= application.id %>"> |
20 | - <td><%= link_to application.name, [:oauth, application] %></td> | |
20 | + <td><%= link_to application.name, oauth_application_path(application) %></td> | |
21 | 21 | <td><%= application.redirect_uri %></td> |
22 | 22 | <td><%= link_to _('Edit'), edit_oauth_application_path(application), class: 'btn btn-link' %></td> |
23 | 23 | <td><%= render 'delete_form', application: application %></td> | ... | ... |
plugins/oauth_provider/views/doorkeeper/applications/new.html.erb
plugins/oauth_provider/views/doorkeeper/applications/show.html.erb
... | ... | @@ -5,13 +5,14 @@ |
5 | 5 | <div class="row"> |
6 | 6 | <div class="col-md-8"> |
7 | 7 | <h4><%= _('Application Id:') %></h4> |
8 | - | |
9 | 8 | <p><code id="application_id"><%= @application.uid %></code></p> |
10 | 9 | |
11 | 10 | <h4><%= _('Secret:') %></h4> |
12 | - | |
13 | 11 | <p><code id="secret"><%= @application.secret %></code></p> |
14 | 12 | |
13 | + <h4><%= _('Scopes') %>:</h4> | |
14 | + <p><code id="scopes"><%= @application.scopes %></code></p> | |
15 | + | |
15 | 16 | <h4><%= _('Callback urls:') %></h4> |
16 | 17 | |
17 | 18 | <table> |
... | ... | @@ -21,6 +22,7 @@ |
21 | 22 | <code><%= uri %></code> |
22 | 23 | </td> |
23 | 24 | <td> |
25 | + <%= link_to _('Authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %> | |
24 | 26 | </td> |
25 | 27 | </tr> |
26 | 28 | <% end %> | ... | ... |
plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb
plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
1 | 1 | <div class="oauth-provider-authorize"> |
2 | - | |
3 | 2 | <header class="page-header" role="banner"> |
4 | 3 | <h1><%= _('Authorize required') %></h1> |
5 | 4 | </header> |
6 | 5 | |
7 | 6 | <main role="main"> |
8 | 7 | <p class="h4"> |
9 | - <%= _('Authorize %s to use your account?') % "<strong class=\"text-info\">#{@pre_auth.client.name}</strong>" %> | |
8 | + <%= _('Authorize %s to use your account?') % "<strong class=\"text-info\">#{@pre_auth.client.name}</strong>" %> | |
10 | 9 | </p> |
11 | 10 | |
12 | - <% if @pre_auth.scopes %> | |
11 | + <% if @pre_auth.scopes.count > 0 %> | |
13 | 12 | <div id="oauth-permissions"> |
14 | 13 | <p><%= _('This application will be able to:') %></p> |
15 | 14 | |
16 | 15 | <ul class="text-info"> |
17 | 16 | <% @pre_auth.scopes.each do |scope| %> |
18 | - <li><%= OauthProviderPlugin::SCOPE_TRANSLATION[scope] %></li> | |
17 | + <li><%= t scope, scope: [:doorkeeper, :scopes] %></li> | |
19 | 18 | <% end %> |
20 | 19 | </ul> |
21 | 20 | </div> |
... | ... | @@ -28,7 +27,7 @@ |
28 | 27 | <%= hidden_field_tag :state, @pre_auth.state %> |
29 | 28 | <%= hidden_field_tag :response_type, @pre_auth.response_type %> |
30 | 29 | <%= hidden_field_tag :scope, @pre_auth.scope %> |
31 | - <%= submit_button :ok, _("Authorize") %> | |
30 | + <%= submit_tag _('Authorize'), class: "btn btn-success btn-lg btn-block" %> | |
32 | 31 | <% end %> |
33 | 32 | <%= form_tag oauth_authorization_path, method: :delete do %> |
34 | 33 | <%= hidden_field_tag :client_id, @pre_auth.client.uid %> |
... | ... | @@ -36,7 +35,7 @@ |
36 | 35 | <%= hidden_field_tag :state, @pre_auth.state %> |
37 | 36 | <%= hidden_field_tag :response_type, @pre_auth.response_type %> |
38 | 37 | <%= hidden_field_tag :scope, @pre_auth.scope %> |
39 | - <%= submit_button :cancel, _("Deny") %> | |
38 | + <%= submit_tag _('Deny'), class: "btn btn-danger btn-lg btn-block" %> | |
40 | 39 | <% end %> |
41 | 40 | </div> |
42 | 41 | </main> | ... | ... |
plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb
plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb
1 | 1 | <%- submit_btn_css ||= 'btn btn-link' %> |
2 | 2 | <%= form_tag oauth_authorized_application_path(application) do %> |
3 | 3 | <input type="hidden" name="_method" value="delete"> |
4 | - <%= submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: submit_btn_css %> | |
4 | + <%= submit_tag _('Revoke'), onclick: "return confirm('#{ _('Are you sure?') }')", class: submit_btn_css %> | |
5 | 5 | <% end %> | ... | ... |
plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb
1 | 1 | <div class="oauth-provider"> |
2 | 2 | <header class="page-header"> |
3 | - <h1>Your authorized applications</h1> | |
3 | + <h1><%= _('Your authorized applications') %></h1> | |
4 | 4 | </header> |
5 | 5 | |
6 | 6 | <main role="main"> |
7 | 7 | <table class="table table-striped"> |
8 | 8 | <thead> |
9 | 9 | <tr> |
10 | - <th>Application</th> | |
11 | - <th>Created At</th> | |
10 | + <th><%= _('Application') %></th> | |
11 | + <th><%= _('Created at') %></th> | |
12 | 12 | <th></th> |
13 | 13 | <th></th> |
14 | 14 | </tr> |
... | ... | @@ -24,7 +24,6 @@ |
24 | 24 | </tbody> |
25 | 25 | </table> |
26 | 26 | </main> |
27 | - | |
28 | 27 | <div class="actions"> |
29 | 28 | <%= button(:back, _('Go back'), :back) %> |
30 | 29 | </div> | ... | ... |