make sure error dialog is shown at the account console when declining terms
Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
This commit is contained in:
parent
35b109b4eb
commit
f9f9a313b3
3 changed files with 19 additions and 12 deletions
|
@ -3273,15 +3273,11 @@ groupDuplicated=Group duplicated
|
|||
duplicateAGroup=Duplicate group
|
||||
couldNotFetchClientRoleMappings=Could not fetch client role mappings\: {{error}}
|
||||
duplicateGroupWarning=Duplication of groups with a large number of subgroups is not supported. Please ensure that the group you are duplicating does not have a large number of subgroups.
|
||||
<<<<<<< HEAD
|
||||
showMemberships=Show memberships
|
||||
showMembershipsTitle={{username}} Group Memberships
|
||||
noGroupMembershipsText=This user is not a member of any groups.
|
||||
noGroupMemberships=No memberships
|
||||
termsAndConditionsDeclined=You need to accept the Terms and Conditions to continue
|
||||
=======
|
||||
termsAndConditionsDeclined=You need to accept the Terms and Conditions to continue
|
||||
somethingWentWrong=Something went wrong
|
||||
somethingWentWrongDescription=Sorry, an unexpected error has occurred.
|
||||
tryAgain=Try again
|
||||
>>>>>>> a163063cc4 (always try and translate the error message)
|
||||
tryAgain=Try again
|
|
@ -79,8 +79,14 @@ export const KeycloakProvider = <T extends BaseEnvironment>({
|
|||
calledOnce.current = true;
|
||||
}, [keycloak]);
|
||||
|
||||
if (error) {
|
||||
return <ErrorPage error={error} />;
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
|
||||
if (error || searchParams.get("error_description")) {
|
||||
return (
|
||||
<ErrorPage
|
||||
error={error ? error : searchParams.get("error_description")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (!init) {
|
||||
|
|
|
@ -3,7 +3,9 @@ package org.keycloak.services.resources.account;
|
|||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.ServerErrorException;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.Response.Status;
|
||||
import jakarta.ws.rs.core.UriBuilder;
|
||||
import org.jboss.resteasy.reactive.NoCache;
|
||||
import org.keycloak.OAuth2Constants;
|
||||
|
@ -109,6 +111,10 @@ public class AccountConsole implements AccountResourceProvider {
|
|||
return redirectToLogin(path);
|
||||
}
|
||||
|
||||
return renderAccountConsole();
|
||||
}
|
||||
|
||||
private Response renderAccountConsole() throws IOException, FreeMarkerException {
|
||||
final var serverUriInfo = session.getContext().getUri(UrlType.FRONTEND);
|
||||
final var serverBaseUri = serverUriInfo.getBaseUri();
|
||||
// Strip any trailing slashes from the URL.
|
||||
|
@ -250,11 +256,10 @@ public class AccountConsole implements AccountResourceProvider {
|
|||
if (!queryParameters.isEmpty()) {
|
||||
String error = queryParameters.getFirst(OAuth2Constants.ERROR);
|
||||
if (error != null) {
|
||||
uriBuilder.queryParam(OAuth2Constants.ERROR, error);
|
||||
|
||||
String errorDescription = queryParameters.getFirst(OAuth2Constants.ERROR_DESCRIPTION);
|
||||
if (errorDescription != null) {
|
||||
uriBuilder.queryParam(OAuth2Constants.ERROR_DESCRIPTION, errorDescription);
|
||||
try {
|
||||
return renderAccountConsole();
|
||||
} catch (IOException | FreeMarkerException e) {
|
||||
throw new ServerErrorException(Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue