From 756b39319ee234b76571d12771f246a978c1eda2 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 15 Oct 2014 15:06:29 -0300 Subject: [PATCH] oauth_provider: add default dookeeper views --- plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb | 5 +++++ plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb | 37 +++++++++++++++++++++++++++++++++++++ plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb | 5 +++++ plugins/oauth_provider/views/doorkeeper/applications/index.html.erb | 26 ++++++++++++++++++++++++++ plugins/oauth_provider/views/doorkeeper/applications/new.html.erb | 5 +++++ plugins/oauth_provider/views/doorkeeper/applications/show.html.erb | 38 ++++++++++++++++++++++++++++++++++++++ plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb | 7 +++++++ plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb | 40 ++++++++++++++++++++++++++++++++++++++++ plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb | 7 +++++++ plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb | 5 +++++ plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb | 25 +++++++++++++++++++++++++ 11 files changed, 200 insertions(+), 0 deletions(-) create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/index.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/new.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/applications/show.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb create mode 100644 plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb diff --git a/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb new file mode 100644 index 0000000..0a407db --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb @@ -0,0 +1,5 @@ +<%- submit_btn_css ||= 'btn btn-link' %> +<%= form_tag [:oauth, application] do %> + + <%= 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 new file mode 100644 index 0000000..4654d72 --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %> + <% if application.errors.any? %> +

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.text_field :name, class: 'form-control' %> + <%= doorkeeper_errors_for application, :name %> +
+ <% 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.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 + + <% end %> +
+ <% end %> + +
+
+ <%= f.submit 'Submit', class: "btn btn-primary" %> + <%= link_to "Cancel", oauth_applications_path, :class => "btn btn-default" %> +
+
+<% end %> + diff --git a/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb b/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb new file mode 100644 index 0000000..06926ae --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb @@ -0,0 +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 new file mode 100644 index 0000000..1584d31 --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/index.html.erb @@ -0,0 +1,26 @@ + + +

<%= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' %>

+ + + + + + + + + + + + <% @applications.each do |application| %> + + + + + + + <% end %> + +
NameCallback URL
<%= link_to application.name, [:oauth, 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 new file mode 100644 index 0000000..68934dd --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/new.html.erb @@ -0,0 +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 new file mode 100644 index 0000000..d3af6fc --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/applications/show.html.erb @@ -0,0 +1,38 @@ + + +
+
+

Application Id:

+ +

<%= @application.uid %>

+ +

Secret:

+ +

<%= @application.secret %>

+ +

Callback urls:

+ + + <% @application.redirect_uri.split.each do |uri| %> + + + + + <% end %> +
+ <%= uri %> + + <%= link_to 'Authorize', oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %> +
+
+ +
+

Actions

+ +

<%= link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary' %>

+ +

<%= render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger' %>

+
+
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb new file mode 100644 index 0000000..d374a6c --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb @@ -0,0 +1,7 @@ + + +
+
<%= @pre_auth.error_response.body[:error_description] %>
+
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb new file mode 100644 index 0000000..c6140c0 --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb @@ -0,0 +1,40 @@ + + +
+

+ Authorize <%= @pre_auth.client.name %> to use your account? +

+ + <% if @pre_auth.scopes %> +
+

This application will be able to:

+ +
    + <% @pre_auth.scopes.each do |scope| %> +
  • <%= t scope, scope: [:doorkeeper, :scopes] %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form_tag oauth_authorization_path, method: :post do %> + <%= hidden_field_tag :client_id, @pre_auth.client.uid %> + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %> + <%= 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" %> + <% end %> + <%= form_tag oauth_authorization_path, method: :delete do %> + <%= hidden_field_tag :client_id, @pre_auth.client.uid %> + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %> + <%= 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" %> + <% end %> +
+
diff --git a/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb b/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb new file mode 100644 index 0000000..2a47be1 --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb @@ -0,0 +1,7 @@ + + +
+ <%= params[:code] %> +
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 new file mode 100644 index 0000000..92b5a61 --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb @@ -0,0 +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 %> +<% 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 new file mode 100644 index 0000000..57e48fc --- /dev/null +++ b/plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb @@ -0,0 +1,25 @@ + + +
+ + + + + + + + + + + <% @applications.each do |application| %> + + + + + + <% end %> + +
ApplicationCreated At
<%= application.name %><%= application.created_at.strftime('%Y-%m-%d %H:%M:%S') %><%= render 'delete_form', application: application %>
+
-- libgit2 0.21.2