Index: MyFormAuthenticator.java =================================================================== --- MyFormAuthenticator.java (.../trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java) (revision 17537) +++ MyFormAuthenticator.java (.../tags/xwiki-core-1.7.2/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java) (revision 17537) @@ -126,20 +126,16 @@ convertUsername(this.persistentLoginManager.getRememberedUsername(request, response), context); String password = this.persistentLoginManager.getRememberedPassword(request, response); - Principal principal = request.getUserPrincipal(); + Principal principal = authenticate(username, password, context); - if (principal == null || context.getWiki().ParamAsLong("xwiki.authentication.always", 0) == 1) { - principal = authenticate(username, password, context); - - if (principal != null) { - if (log.isDebugEnabled()) { - log.debug("User " + principal.getName() + " has been authentified from cookie"); - } - request.setUserPrincipal(principal); - } else if (username != null || password != null) { - // failed authentication with remembered login, better forget login now - this.persistentLoginManager.forgetLogin(request, response); + if (principal != null) { + if (log.isDebugEnabled()) { + log.debug("User " + principal.getName() + " has been authentified from cookie"); } + request.setUserPrincipal(principal); + } else if (username != null || password != null) { + // failed authentication with remembered login, better forget login now + this.persistentLoginManager.forgetLogin(request, response); } }