Images and login context (#1417)

* init

* revert
This commit is contained in:
Anthony Stirling 2024-06-08 16:07:23 +01:00 committed by GitHub
parent 10472a6467
commit ef59ea6fe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 8 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 44 KiB

BIN
images/settings-light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

View file

@ -58,7 +58,8 @@ public class CleanUrlInterceptor implements HandlerInterceptor {
// Redirect to the URL with only allowed query parameters // Redirect to the URL with only allowed query parameters
String redirectUrl = requestURI + "?" + newQueryString; String redirectUrl = requestURI + "?" + newQueryString;
response.sendRedirect(redirectUrl);
response.sendRedirect(request.getContextPath() + redirectUrl);
return false; return false;
} }
} }

View file

@ -42,9 +42,11 @@ public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationF
String ip = request.getRemoteAddr(); String ip = request.getRemoteAddr();
logger.error("Failed login attempt from IP: {}", ip); logger.error("Failed login attempt from IP: {}", ip);
String contextPath = request.getContextPath();
if (exception.getClass().isAssignableFrom(InternalAuthenticationServiceException.class) if (exception.getClass().isAssignableFrom(InternalAuthenticationServiceException.class)
|| "Password must not be null".equalsIgnoreCase(exception.getMessage())) { || "Password must not be null".equalsIgnoreCase(exception.getMessage())) {
response.sendRedirect("/login?error=oauth2AuthenticationError"); response.sendRedirect(contextPath + "/login?error=oauth2AuthenticationError");
return; return;
} }
@ -59,13 +61,13 @@ public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationF
loginAttemptService.loginFailed(username); loginAttemptService.loginFailed(username);
if (loginAttemptService.isBlocked(username) if (loginAttemptService.isBlocked(username)
|| exception.getClass().isAssignableFrom(LockedException.class)) { || exception.getClass().isAssignableFrom(LockedException.class)) {
response.sendRedirect("/login?error=locked"); response.sendRedirect(contextPath + "/login?error=locked");
return; return;
} }
} }
if (exception.getClass().isAssignableFrom(BadCredentialsException.class) if (exception.getClass().isAssignableFrom(BadCredentialsException.class)
|| exception.getClass().isAssignableFrom(UsernameNotFoundException.class)) { || exception.getClass().isAssignableFrom(UsernameNotFoundException.class)) {
response.sendRedirect("/login?error=badcredentials"); response.sendRedirect(contextPath + "/login?error=badcredentials");
return; return;
} }

View file

@ -44,7 +44,7 @@ public class FirstLoginFilter extends OncePerRequestFilter {
&& user.isPresent() && user.isPresent()
&& user.get().isFirstLogin() && user.get().isFirstLogin()
&& !"/change-creds".equals(requestURI)) { && !"/change-creds".equals(requestURI)) {
response.sendRedirect("/change-creds"); response.sendRedirect(request.getContextPath() + "/change-creds");
return; return;
} }
} }