diff --git a/changelog.html b/changelog.html
index afa74a9a4b..8e13feacee 100644
--- a/changelog.html
+++ b/changelog.html
@@ -72,6 +72,9 @@ Upcoming changes
(issue 14769)
Description preview and syntax highlighting broken since 1.477.
+
+ Parameter values disappear if user is not logged in
+ (issue 7894)
diff --git a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
index 79cf8ed68e..6a3c21efec 100644
--- a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
+++ b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
@@ -23,6 +23,7 @@
*/
package hudson.security;
+import com.google.common.base.Strings;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint;
@@ -74,8 +75,10 @@ public class HudsonAuthenticationEntryPoint extends AuthenticationProcessingFilt
rsp.sendError(SC_FORBIDDEN);
} else {
// give the opportunity to include the target URL
+ String uriFrom = req.getRequestURI();
+ if(!Strings.isNullOrEmpty(req.getQueryString())) uriFrom += "?" + req.getQueryString();
String loginForm = req.getContextPath()+getLoginFormUrl();
- loginForm = MessageFormat.format(loginForm, URLEncoder.encode(req.getRequestURI(),"UTF-8"));
+ loginForm = MessageFormat.format(loginForm, URLEncoder.encode(uriFrom,"UTF-8"));
req.setAttribute("loginForm", loginForm);
rsp.setStatus(SC_FORBIDDEN);