use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationActionWithTokenDTO in project ArachneCentralAPI by OHDSI.
the class BaseUserController method invitationAcceptViaMail.
@ApiOperation("Accept invitations via mail.")
@RequestMapping(value = "/api/v1/user-management/users/invitations/mail", method = GET)
public JsonResult<UserProfileDTO> invitationAcceptViaMail(@RequestParam("id") Long id, @RequestParam("accepted") Boolean accepted, @RequestParam("type") String type, @RequestParam("token") String token, @RequestParam(value = "userId", required = false) Long userId, HttpServletResponse response) throws NotExistException, AlreadyExistException, IOException {
InvitationActionWithTokenDTO dto = new InvitationActionWithTokenDTO(id, type, accepted, token);
String redirectLink;
U user;
try {
user = getUserFromInvitationDto(dto, userId);
redirectLink = getRedirectLinkFromInvitationDto(dto, id, token);
} catch (NotExistException ex) {
JsonResult result = new JsonResult<>(VALIDATION_ERROR);
result.setErrorMessage(ex.getMessage());
response.sendRedirect(INVITATION_HOME_PAGE);
return result;
}
response.sendRedirect(redirectLink);
return invitationAccept(dto, user);
}
Aggregations