Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,18 @@ public ApiResponse login(
@Timed
public ApiResponse roles(
@FormParam("email") String email,
@FormParam("handle") String handle,
@Context HttpServletRequest request) throws Exception {

if(Utils.isEmpty(email))
throw new APIRuntimeException(SC_BAD_REQUEST, String.format(MSG_TEMPLATE_MANDATORY, "email"));
if(Utils.isEmpty(email) && Utils.isEmpty(handle))
throw new APIRuntimeException(SC_BAD_REQUEST, String.format(MSG_TEMPLATE_MANDATORY, "email/handle"));

User user = userDao.findUserByEmail(email);
User user = null;
if (!Utils.isEmpty(handle)) {
user = userDao.findUserByHandle(handle);
} else{
user = userDao.findUserByEmail(email);
}

if(user==null) {
throw new APIRuntimeException(SC_UNAUTHORIZED, "Credentials are incorrect.");
Expand Down