*/
public static LoginResultStatus internalCheckLogin(final WebPage page, final UserDao userDao, final String username, final String password,
final boolean userWantsToStayLoggedIn, final Class< ? extends WebPage> defaultPage)
{
final LoginResult loginResult = Login.getInstance().checkLogin(username, password);
final PFUserDO user = loginResult.getUser();
if (user == null || loginResult.getLoginResultStatus() != LoginResultStatus.SUCCESS) {
return loginResult.getLoginResultStatus();
}
if (UserFilter.isUpdateRequiredFirst() == true) {
internalLogin(page, user);
log.info("Admin login for maintenance (data-base update) successful for user '" + username + "'.");
throw new RestartResponseException(SystemUpdatePage.class);
}
log.info("User successfully logged in: " + user.getDisplayUsername());
if (userWantsToStayLoggedIn == true) {
final PFUserDO loggedInUser = userDao.internalGetById(user.getId());
final Cookie cookie = new Cookie("stayLoggedIn", loggedInUser.getId()
+ ":"
+ loggedInUser.getUsername()
+ ":"
+ userDao.getStayLoggedInKey(user.getId()));
UserFilter.addStayLoggedInCookie(WicketUtils.getHttpServletRequest(page.getRequest()),
WicketUtils.getHttpServletResponse(page.getResponse()), cookie);
}