Skip to content

Commit

Permalink
Fix #1072: Failed input validations not processed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
romanstrobl committed Jan 3, 2022
1 parent 913d15a commit 7a146e2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public AuthenticationExceptionResolver(Audit audit) {
*/
@ExceptionHandler(AuthStepException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public @ResponseBody ErrorResponse handleMethodNotValidException(AuthStepException ex) {
public @ResponseBody ErrorResponse handleAuthStepException(AuthStepException ex) {
logger.warn("Error occurred in Web Flow server: {}", ex.getMessage());
audit.warn("Error occurred in Web Flow server: {}", AUDIT_DETAIL_BAD_REQUEST, ex);
// Web Flow returns message ID for front-end localization instead of message.
Expand Down
13 changes: 13 additions & 0 deletions powerauth-webflow/src/main/js/actions/loginScaActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ export function authenticate(username, organizationId) {
}
return null;
}).catch((error) => {
// Handle request validation errors
if (error.response.status === 400 && error.response.data.message !== undefined) {
dispatch({
type: "SHOW_SCREEN_LOGIN_SCA",
payload: {
loading: false,
error: true,
message: error.response.data.message,
remainingAttempts: error.response.data.remainingAttempts
}
});
return;
}
dispatchError(dispatch, error);
})
}
Expand Down
13 changes: 13 additions & 0 deletions powerauth-webflow/src/main/js/actions/smsAuthActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ export function authenticate(userAuthCode, userPassword, component) {
}
return null;
}).catch((error) => {
// Handle request validation errors
if (error.response.status === 400 && error.response.data.message !== undefined) {
dispatch({
type: getActionType(component),
payload: {
loading: false,
error: true,
message: error.response.data.message,
remainingAttempts: error.response.data.remainingAttempts
}
});
return;
}
dispatchError(dispatch, error);
})
}
Expand Down

0 comments on commit 7a146e2

Please sign in to comment.