Пример #1
0
  /**
   * Shows login page.
   *
   * @param context the specified context
   * @throws Exception exception
   */
  @RequestProcessing(value = "/login", method = HTTPRequestMethod.GET)
  public void showLogin(final HTTPRequestContext context) throws Exception {
    final HttpServletRequest request = context.getRequest();

    String destinationURL = request.getParameter(Common.GOTO);

    if (Strings.isEmptyOrNull(destinationURL)) {
      destinationURL = Latkes.getServePath() + Common.ADMIN_INDEX_URI;
    }

    final HttpServletResponse response = context.getResponse();

    userMgmtService.tryLogInWithCookie(request, response);

    if (null != userService.getCurrentUser(request)) { // User has already logged in
      response.sendRedirect(destinationURL);

      return;
    }

    renderPage(context, "login.ftl", destinationURL, request);
  }