class AcceptApplicationKtaInviteController extends AbstractAcceptInviteController {

    @GetMapping("/kta/accept-invite/{hash}")
    @SecuredBySpring(value = "READ", description = "All users can view the invite to join an application.")
    @PreAuthorize("permitAll")
    public String inviteEntryPage(
            @PathVariable("hash") final String hash,
            UserResource loggedInUser,
            HttpServletResponse response,
            Model model) {

        RestResult<ApplicationKtaInviteResource> invite = ktaInviteRestService.getKtaInviteByHash(hash);
        if (invite.isSuccess()) {
            if (!InviteStatus.SENT.equals(invite.getSuccess().getStatus())) {
                return alreadyAcceptedView(response);
            }
            if (loggedInAsNonKtaInviteUser(invite.getSuccess(), loggedInUser)) {
                return LOGGED_IN_WITH_ANOTHER_USER_VIEW;
            }
            model.addAttribute("model", acceptRejectApplicationKtaInviteModelPopulator.populateModel(invite.getSuccess()));
            return "registration/accept-invite-kta-user";
        } else {
            return URL_HASH_INVALID_TEMPLATE;
        }
    }

}