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
|
duplicateAGroup=Duplicate group
|
||||||
couldNotFetchClientRoleMappings=Could not fetch client role mappings\: {{error}}
|
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.
|
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
|
showMemberships=Show memberships
|
||||||
showMembershipsTitle={{username}} Group Memberships
|
showMembershipsTitle={{username}} Group Memberships
|
||||||
noGroupMembershipsText=This user is not a member of any groups.
|
noGroupMembershipsText=This user is not a member of any groups.
|
||||||
noGroupMemberships=No memberships
|
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
|
||||||
=======
|
|
||||||
termsAndConditionsDeclined=You need to accept the Terms and Conditions to continue
|
|
||||||
somethingWentWrong=Something went wrong
|
somethingWentWrong=Something went wrong
|
||||||
somethingWentWrongDescription=Sorry, an unexpected error has occurred.
|
somethingWentWrongDescription=Sorry, an unexpected error has occurred.
|
||||||
tryAgain=Try again
|
tryAgain=Try again
|
||||||
>>>>>>> a163063cc4 (always try and translate the error message)
|
|
|
@ -79,8 +79,14 @@ export const KeycloakProvider = <T extends BaseEnvironment>({
|
||||||
calledOnce.current = true;
|
calledOnce.current = true;
|
||||||
}, [keycloak]);
|
}, [keycloak]);
|
||||||
|
|
||||||
if (error) {
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
return <ErrorPage error={error} />;
|
|
||||||
|
if (error || searchParams.get("error_description")) {
|
||||||
|
return (
|
||||||
|
<ErrorPage
|
||||||
|
error={error ? error : searchParams.get("error_description")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
|
|
|
@ -3,7 +3,9 @@ package org.keycloak.services.resources.account;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.PathParam;
|
import jakarta.ws.rs.PathParam;
|
||||||
|
import jakarta.ws.rs.ServerErrorException;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
import jakarta.ws.rs.core.Response.Status;
|
||||||
import jakarta.ws.rs.core.UriBuilder;
|
import jakarta.ws.rs.core.UriBuilder;
|
||||||
import org.jboss.resteasy.reactive.NoCache;
|
import org.jboss.resteasy.reactive.NoCache;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
|
@ -109,6 +111,10 @@ public class AccountConsole implements AccountResourceProvider {
|
||||||
return redirectToLogin(path);
|
return redirectToLogin(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return renderAccountConsole();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response renderAccountConsole() throws IOException, FreeMarkerException {
|
||||||
final var serverUriInfo = session.getContext().getUri(UrlType.FRONTEND);
|
final var serverUriInfo = session.getContext().getUri(UrlType.FRONTEND);
|
||||||
final var serverBaseUri = serverUriInfo.getBaseUri();
|
final var serverBaseUri = serverUriInfo.getBaseUri();
|
||||||
// Strip any trailing slashes from the URL.
|
// Strip any trailing slashes from the URL.
|
||||||
|
@ -250,11 +256,10 @@ public class AccountConsole implements AccountResourceProvider {
|
||||||
if (!queryParameters.isEmpty()) {
|
if (!queryParameters.isEmpty()) {
|
||||||
String error = queryParameters.getFirst(OAuth2Constants.ERROR);
|
String error = queryParameters.getFirst(OAuth2Constants.ERROR);
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
uriBuilder.queryParam(OAuth2Constants.ERROR, error);
|
try {
|
||||||
|
return renderAccountConsole();
|
||||||
String errorDescription = queryParameters.getFirst(OAuth2Constants.ERROR_DESCRIPTION);
|
} catch (IOException | FreeMarkerException e) {
|
||||||
if (errorDescription != null) {
|
throw new ServerErrorException(Status.INTERNAL_SERVER_ERROR);
|
||||||
uriBuilder.queryParam(OAuth2Constants.ERROR_DESCRIPTION, errorDescription);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue