Using Camo for the application logo
This commit is contained in:
parent
3fb2d262b8
commit
07c12ba057
12 changed files with 106 additions and 22 deletions
|
|
@ -36,19 +36,17 @@
|
|||
}
|
||||
|
||||
.application-img {
|
||||
display: inline;
|
||||
padding: 9px 0;
|
||||
margin: 9px 0;
|
||||
float: left;
|
||||
width: 60px;
|
||||
max-height: 60px;
|
||||
text-align: center;
|
||||
|
||||
&, img {
|
||||
width: 70px;
|
||||
max-height: 70px;
|
||||
}
|
||||
|
||||
[class^="entypo-"] {
|
||||
font-size: 60px;
|
||||
height: 0;
|
||||
height: 60px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
&::before {
|
||||
position: relative;
|
||||
|
|
@ -58,7 +56,7 @@
|
|||
}
|
||||
|
||||
.application-authorizations {
|
||||
width: calc(100% - 70px);
|
||||
width: calc(100% - 60px);
|
||||
padding: 0 0 15px 15px;
|
||||
display: inline-block;
|
||||
float: right;
|
||||
|
|
|
|||
|
|
@ -4,19 +4,17 @@
|
|||
}
|
||||
|
||||
.application-img {
|
||||
display: inline;
|
||||
padding: 9px 0;
|
||||
margin: 9px 0;
|
||||
float: left;
|
||||
width: 60px;
|
||||
max-height: 60px;
|
||||
text-align: center;
|
||||
|
||||
&, img {
|
||||
width: 70px;
|
||||
max-height: 70px;
|
||||
}
|
||||
|
||||
[class^="entypo-"] {
|
||||
font-size: 60px;
|
||||
height: 0;
|
||||
height: 60px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
&::before {
|
||||
position: relative;
|
||||
|
|
@ -26,7 +24,7 @@
|
|||
}
|
||||
|
||||
.application-authorizations {
|
||||
width: calc(100% - 70px);
|
||||
width: calc(100% - 60px);
|
||||
padding: 0 0 15px 15px;
|
||||
display: inline-block;
|
||||
float: right;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ module Api
|
|||
begin
|
||||
Api::OpenidConnect::Authorization.find_by(id: params[:id]).destroy
|
||||
rescue
|
||||
# TODO: Log something here?
|
||||
logger.error "Error while trying revoke inexistant authorization #{params[:id]}"
|
||||
end
|
||||
redirect_to user_applications_url
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ module Api
|
|||
self.client_secret = SecureRandom.hex(32)
|
||||
end
|
||||
|
||||
def image_uri
|
||||
logo_uri ? Diaspora::Camo.image_url(logo_uri) : nil
|
||||
end
|
||||
|
||||
class << self
|
||||
def available_response_types
|
||||
["id_token", "id_token token", "code"]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class UserApplicationsPresenter
|
|||
{
|
||||
id: find_id(application),
|
||||
name: application.client_name,
|
||||
image: application.logo_uri,
|
||||
image: application.image_uri,
|
||||
authorizations: find_scopes(application)
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
- if @user_apps.applications?
|
||||
%ul.list-group
|
||||
- @user_apps.user_applications.each do |app|
|
||||
%li.list-group-item
|
||||
%li.list-group-item.authorized-application
|
||||
.application-img
|
||||
- if app[:image]
|
||||
= image_tag app[:image], class: "img-responsive"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
=t("user_applications.show.no_requirement")
|
||||
= form_for "application", url: "#{api_openid_connect_authorizations_path}/#{app[:id]}",
|
||||
html: { method: :delete, class: "form-horizontal"} do |f|
|
||||
.clearfix= f.submit t("user_applications.revoke_autorization"), class: "btn btn-primary pull-right"
|
||||
.clearfix= f.submit t("user_applications.revoke_autorization"), class: "btn btn-danger pull-right app-revoke"
|
||||
|
||||
- else
|
||||
.well
|
||||
|
|
|
|||
24
features/desktop/user_applications.feature
Normal file
24
features/desktop/user_applications.feature
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
@javascript
|
||||
Feature: managing authorized applications
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Augier | augier@example.org |
|
||||
And all scopes exist
|
||||
And a client with a provided picture exists for user "augier@example.org"
|
||||
And a client exists for user "augier@example.org"
|
||||
|
||||
Scenario: displaying authorizations
|
||||
When I sign in as "augier@example.org"
|
||||
And I go to the user applications page
|
||||
Then I should see 2 authorized applications
|
||||
And I should see 1 authorized applications with no provided image
|
||||
And I should see 1 authorized applications with an image
|
||||
|
||||
Scenario: revoke an authorization
|
||||
When I sign in as "augier@example.org"
|
||||
And I go to the user applications page
|
||||
And I revoke the first authorization
|
||||
Then I should see 1 authorized applications
|
||||
And I revoke the first authorization
|
||||
Then I should see 0 authorized applications
|
||||
25
features/mobile/user_applications.feature
Normal file
25
features/mobile/user_applications.feature
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@mobile
|
||||
@javascript
|
||||
Feature: managing authorized applications
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Augier | augier@example.org |
|
||||
And all scopes exist
|
||||
And a client with a provided picture exists for user "augier@example.org"
|
||||
And a client exists for user "augier@example.org"
|
||||
|
||||
Scenario: displaying authorizations
|
||||
When I sign in as "augier@example.org"
|
||||
And I go to the user applications page
|
||||
Then I should see 2 authorized applications
|
||||
And I should see 1 authorized applications with no provided image
|
||||
And I should see 1 authorized applications with an image
|
||||
|
||||
Scenario: revoke an authorization
|
||||
When I sign in as "augier@example.org"
|
||||
And I go to the user applications page
|
||||
And I revoke the first authorization
|
||||
Then I should see 1 authorized applications
|
||||
And I revoke the first authorization
|
||||
Then I should see 0 authorized applications
|
||||
|
|
@ -3,6 +3,17 @@ Given(/^all scopes exist$/) do
|
|||
Api::OpenidConnect::Scope.find_or_create_by(name: "read")
|
||||
end
|
||||
|
||||
Given /^a client with a provided picture exists for user "([^\"]*)"$/ do |email|
|
||||
app = FactoryGirl.create(:o_auth_application_with_image)
|
||||
user = User.find_by(email: email)
|
||||
FactoryGirl.create(:auth_with_read, user: user, o_auth_application: app)
|
||||
end
|
||||
|
||||
Given /^a client exists for user "([^\"]*)"$/ do |email|
|
||||
user = User.find_by(email: email)
|
||||
FactoryGirl.create(:auth_with_read, user: user)
|
||||
end
|
||||
|
||||
When /^I register a new client$/ do
|
||||
post api_openid_connect_clients_path, redirect_uris: ["http://localhost:3000"], client_name: "diaspora client"
|
||||
end
|
||||
|
|
|
|||
16
features/step_definitions/user_applications_steps.rb
Normal file
16
features/step_definitions/user_applications_steps.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Then /^I should see (\d+) authorized applications$/ do |num|
|
||||
expect(page).to have_selector(".applications-page", count: 1)
|
||||
expect(page).to have_selector(".authorized-application", count: num.to_i)
|
||||
end
|
||||
|
||||
Then /^I should see (\d+) authorized applications with no provided image$/ do |num|
|
||||
expect(page).to have_selector(".application-img > .entypo-browser", count: num.to_i)
|
||||
end
|
||||
|
||||
Then /^I should see (\d+) authorized applications with an image$/ do |num|
|
||||
expect(page).to have_selector(".application-img > .img-responsive", count: num.to_i)
|
||||
end
|
||||
|
||||
When /^I revoke the first authorization$/ do
|
||||
find(".app-revoke", match: :first).click
|
||||
end
|
||||
|
|
@ -36,6 +36,8 @@ module NavigationHelpers
|
|||
edit_user_path
|
||||
when /^forgot password page$/
|
||||
new_user_password_path
|
||||
when /^user applications page$/
|
||||
user_applications_path
|
||||
when %r{^"(/.*)"}
|
||||
Regexp.last_match(1)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -315,6 +315,12 @@ FactoryGirl.define do
|
|||
redirect_uris ["http://localhost:3000/"]
|
||||
end
|
||||
|
||||
factory :o_auth_application_with_image, class: Api::OpenidConnect::OAuthApplication do
|
||||
client_name "Diaspora Test Client"
|
||||
redirect_uris ["http://localhost:3000/"]
|
||||
logo_uri "/assets/user/default.png"
|
||||
end
|
||||
|
||||
factory :o_auth_application_with_ppid, class: Api::OpenidConnect::OAuthApplication do
|
||||
client_name "Diaspora Test Client"
|
||||
redirect_uris ["http://localhost:3000/"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue