Commit ebeafb78 authored by augier's avatar augier Committed by Kent Shikama

Add custom error page when prompt=none

parent 10938404
......@@ -104,3 +104,6 @@
// settings
@import 'user_applications';
// API
@import "openid_connect_error_page";
.api-error {
margin-top: 20px;
box-shadow: $card-shadow;
background-color: $light-grey;
h4 { text-align: center; }
}
......@@ -110,8 +110,7 @@ module Api
if auth
process_authorization_consent("true")
else
handle_params_error("interaction_required",
"The Authentication Request cannot be completed without end-user interaction")
render_error "The Authentication Request cannot be completed without end-user interaction"
end
else
handle_params_error("invalid_request",
......@@ -219,12 +218,19 @@ module Api
def auth_user_unless_prompt_none!
if params[:prompt] == "none" && !user_signed_in?
handle_params_error("login_required",
"User must already be logged in when 'prompt' is 'none'")
render_error "User must be first logged in when `prompt` is `none`"
# render json: {error: "login_required",
# description: "User must be first logged in when `prompt` is `none`"}
else
authenticate_user!
end
end
def render_error(error_description)
@error_description = error_description
render "api/openid_connect/error/error",
layout: request.format == :mobile ? "application" : "with_header_with_footer"
end
end
end
end
.container-fluid
.row
.api-error.col-sm-6.col-sm-offset-3
%h4
%b= t("api.openid_connect.error_page.title")
%div= @error_description
= render partial: "api/openid_connect/error/error"
= render partial: "api/openid_connect/error/error"
......@@ -917,6 +917,8 @@ en:
write:
name: "send posts, conversations and reactions"
description: "This allows the application to send new posts, write conversations, and send reactions"
error_page:
title: "Oh! Something went wrong :("
people:
zero: "No people"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment