Fix pronto remarks

This commit is contained in:
theworldbright 2015-11-22 14:15:13 -08:00
parent 773a5a67d9
commit fd4022a55c
4 changed files with 23 additions and 20 deletions

View file

@ -1,7 +1,7 @@
@import 'perfect-scrollbar'; @import 'perfect-scrollbar';
@import 'color-variables'; @import 'color-variables';
@import "bootstrap-complete.scss"; @import 'bootstrap-complete';
@import 'mixins'; @import 'mixins';
@ -99,11 +99,11 @@
@import 'statistics'; @import 'statistics';
/* gallery */ /* gallery */
@import "blueimp-gallery"; @import 'blueimp-gallery';
@import "gallery"; @import 'gallery';
// settings // settings
@import 'user_applications'; @import 'user_applications';
// API // OpenID Connect (API)
@import "openid_connect_error_page"; @import 'openid_connect_error_page';

View file

@ -1,7 +1,7 @@
.api-error { .api-error {
margin-top: 20px;
box-shadow: $card-shadow;
background-color: $light-grey; background-color: $light-grey;
box-shadow: $card-shadow;
margin-top: 20px;
h4 { text-align: center; } h4 { text-align: center; }
} }

View file

@ -3,7 +3,7 @@ module Api
class AuthorizationsController < ApplicationController class AuthorizationsController < ApplicationController
rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e| rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
logger.info e.backtrace[0, 10].join("\n") logger.info e.backtrace[0, 10].join("\n")
error, description = e.message.split(" :: ") error, _description = e.message.split(" :: ")
handle_params_error(error, "The request was malformed: please double check the client id and redirect uri.") handle_params_error(error, "The request was malformed: please double check the client id and redirect uri.")
end end
@ -210,17 +210,7 @@ module Api
def handle_prompt_none def handle_prompt_none
if params[:prompt] == "none" if params[:prompt] == "none"
if user_signed_in? if user_signed_in?
client_id = params[:client_id] handle_prompt_with_signed_in_user
if client_id
auth = Api::OpenidConnect::Authorization.find_by_client_id_and_user(client_id, current_user)
if auth
process_authorization_consent("true")
else
handle_params_error("interaction_required", "User must already be authorized when `prompt` is `none`")
end
else
handle_params_error("bad_request", "Client ID is missing from request")
end
else else
handle_params_error("login_required", "User must already be logged in when `prompt` is `none`") handle_params_error("login_required", "User must already be logged in when `prompt` is `none`")
end end
@ -229,6 +219,20 @@ module Api
end end
end end
def handle_prompt_with_signed_in_user
client_id = params[:client_id]
if client_id
auth = Api::OpenidConnect::Authorization.find_by_client_id_and_user(client_id, current_user)
if auth
process_authorization_consent("true")
else
handle_params_error("interaction_required", "User must already be authorized when `prompt` is `none`")
end
else
handle_params_error("bad_request", "Client ID is missing from request")
end
end
def render_error(error_description) def render_error(error_description)
@error_description = error_description @error_description = error_description
render "api/openid_connect/error/error", render "api/openid_connect/error/error",

View file

@ -37,4 +37,3 @@ end
Then(/^I should see a message containing "(.*?)"$/) do |message| Then(/^I should see a message containing "(.*?)"$/) do |message|
expect(find("#openid_connect_error_description").text).to eq(message) expect(find("#openid_connect_error_description").text).to eq(message)
end end