Skip to content

Commit f95f2ff

Browse files
authored
feat: Redesigns OAuth2 portal (#404)
* feat: Redesigns OAuth2 portal * fix: Some Hound issues * Changes application verbiage * Fixes ID issue * Fixes table link and sign out button * Peter's wishes
1 parent b6963e6 commit f95f2ff

File tree

16 files changed

+205
-18
lines changed

16 files changed

+205
-18
lines changed

app/assets/stylesheets/forms/_forms.sass

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ hr
9191
margin-left: -1 * $form-spacing-horizontal
9292
margin-right: -1 * $form-spacing-horizontal
9393

94+
.actions
95+
display: flex
96+
justify-content: flex-end
97+
9498
.input
9599
flex: 1 1 600px
96100
display: flex

app/assets/stylesheets/general/_header.sass

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ $account-nav-padding-vert: 15px
2323
.header-nav
2424
display: flex
2525
align-items: center
26+
width: 100%
2627
.button
2728
margin-right: 10px
2829
&:last-child
2930
margin-right: 0
3031

32+
.header-nav.start
33+
justify-content: flex-start
34+
flex-shrink: 2
35+
36+
.header-nav.end
37+
justify-content: flex-end
38+
3139
.account-nav
3240
@include css4
3341
border-bottom: 1px solid var(--account-nav--border-color)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.form-container
2+
= bs_horizontal_simple_form_for(@application, url: doorkeeper_submit_path(@application)) do |f|
3+
= f.error_notification
4+
5+
.form-inputs
6+
= f.input :name, required: true
7+
= f.input :redirect_uri, required: true
8+
= f.input :confidential
9+
= f.input :scopes
10+
11+
.center
12+
= f.button :submit, class: 'btn-primary'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= render "layouts/manage/page_title", title: @application.name, subtitle: t(:title, scope: 'doorkeeper.applications.edit')
2+
3+
= render 'form'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
= render "layouts/manage/page_title", title: t(:title, scope: 'pages.manage.doorkeeper'), docs: 'https://coderit.org/hackathon-manager/docs/busses' do
2+
= link_to t(:new, scope: 'doorkeeper.applications.index'), new_oauth_application_path, class: "btn btn-sm btn-outline-secondary"
3+
4+
.mb-4
5+
%table.table.table-striped.table-hover
6+
%thead
7+
%tr
8+
%th
9+
%th
10+
= t(:name, scope: 'doorkeeper.applications.index')
11+
%th
12+
= t(:callback_url, scope: 'doorkeeper.applications.index')
13+
%th
14+
= t(:confidential, scope: 'doorkeeper.applications.index')
15+
16+
17+
%tbody
18+
- @applications.each do |application|
19+
%tr
20+
%td
21+
= link_to('<i class="fa fa-search"></i>'.html_safe, oauth_application_path(application))
22+
%td
23+
%strong
24+
= application.name
25+
%td
26+
= simple_format(application.redirect_uri)
27+
%td
28+
= application.confidential? ? t('doorkeeper.applications.index.confidentiality.yes') : t('doorkeeper.applications.index.confidentiality.no')
29+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= render "layouts/manage/page_title", title: t(:title, scope: 'doorkeeper.applications.new')
2+
3+
= render 'form'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
= render "layouts/manage/page_title", title: @application.name, subtitle: t(:title, scope: 'doorkeeper.applications.show') do
2+
.btn-group
3+
= link_to t('doorkeeper.applications.buttons.edit'), edit_oauth_application_path(@application), class: 'btn btn-sm btn-outline-secondary'
4+
= link_to t('doorkeeper.applications.buttons.destroy'), oauth_application_path(@application), method: :delete, data: { confirm: t('doorkeeper.applications.confirmations.destroy', name: @application.name) }, class: 'btn btn-sm btn-outline-secondary'
5+
6+
.row
7+
.col-lg-6
8+
%h4.border-bottom.pb-2.mb-3 Details
9+
%dl.row
10+
%dt.col-md-4
11+
= t('.application_id')
12+
%dd.col-md-8
13+
%code.bg-light
14+
= @application.uid
15+
%dt.col-md-4
16+
= t('.secret')
17+
%dd.col-md-8
18+
%code.bg-light
19+
= flash[:application_secret].presence || @application.plaintext_secret
20+
%dt.col-md-4
21+
= t('.scopes')
22+
%dd.col-md-8
23+
- if @application.scopes.present?
24+
= @application.scopes
25+
- else
26+
%bg-light.font-italic.text-muted
27+
= t('.not_defined')
28+
%dt.col-md-4
29+
= t('.confidential')
30+
%dd.col-md-8
31+
= @application.confidential? ? "Yes" : "No"
32+
33+
.col-lg-6
34+
.h4.border-bottom.pb-2.mb-3
35+
= t('.callback_urls')
36+
%table.table.table-striped.table-hover
37+
%tbody
38+
- @application.redirect_uri.split.each do |uri|
39+
%tr
40+
%td
41+
= uri
42+
%td
43+
= link_to t('doorkeeper.applications.buttons.authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code', scope: @application.scopes), class: 'btn btn-sm btn-outline-primary', target: '_blank'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.form-container
2+
#disclaimer
3+
%h1.section-title
4+
Authorization
5+
%span.emphasized Error
6+
%p
7+
= @pre_auth.error_response.body[:error_description]
8+
%p
9+
= raw t('doorkeeper.errors.messages.get_help', hackathon_name: content_tag(:strong, class: 'text-info') { HackathonConfig['name'] })
10+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.form-container
2+
#disclaimer
3+
%h1.section-title
4+
Authorization
5+
%span.emphasized Required
6+
%p
7+
= raw t('.prompt', client_name: content_tag(:strong, class: 'text-info') { @pre_auth.client.name })
8+
%p
9+
= t('.able_to')
10+
.actions
11+
= form_tag oauth_authorization_path, method: :delete, style: "padding-right: 10px;" do
12+
= hidden_field_tag :client_id, @pre_auth.client.uid
13+
= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri
14+
= hidden_field_tag :state, @pre_auth.state
15+
= hidden_field_tag :response_type, @pre_auth.response_type
16+
= hidden_field_tag :scope, @pre_auth.scope
17+
= hidden_field_tag :code_challenge, @pre_auth.code_challenge
18+
= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method
19+
= submit_tag t('doorkeeper.authorizations.buttons.deny')
20+
= form_tag oauth_authorization_path, method: :post do
21+
= hidden_field_tag :client_id, @pre_auth.client.uid
22+
= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri
23+
= hidden_field_tag :state, @pre_auth.state
24+
= hidden_field_tag :response_type, @pre_auth.response_type
25+
= hidden_field_tag :scope, @pre_auth.scope
26+
= hidden_field_tag :code_challenge, @pre_auth.code_challenge
27+
= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method
28+
= submit_tag t('doorkeeper.authorizations.buttons.authorize')

app/views/layouts/_header.html.haml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
= link_to homepage_url do
77
= image_tag HackathonConfig['logo_asset'], id: 'logo', alt: "#{HackathonConfig['name']} logo", title: HackathonConfig['name'], class: 'header-logo__image'
88
- else
9-
.header-nav
9+
.header-nav.start
1010
= btn_link_to "Home", homepage_url
11-
.header-nav
11+
.header-nav.end
1212
- if user_signed_in?
1313
- if current_user.organizing_staff?
1414
= btn_link_to "Manage", manage_root_path

0 commit comments

Comments
 (0)