]> source.dussan.org Git - sonarqube.git/commitdiff
fix redirection after login where there are many parameters
authorStas Vilchik <vilchiks@gmail.com>
Tue, 15 Nov 2016 16:21:03 +0000 (17:21 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 15 Nov 2016 16:21:13 +0000 (17:21 +0100)
it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java
it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_with_parameters_after_direct_login.html [new file with mode: 0644]
server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb

index 76c601b0e1c6fb7ccd64c7724d8f7fc537e97d4d..2befdda21eea0b6c2123801344cea4129a727229 100644 (file)
@@ -214,6 +214,7 @@ public class LocalAuthenticationTest {
       "/user/LocalAuthenticationTest/redirect_to_login_when_not_enough_privilege.html",
       // SONAR-2132
       "/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html",
+      "/user/LocalAuthenticationTest/redirect_to_original_url_with_parameters_after_direct_login.html",
       // SONAR-2009
       "/user/LocalAuthenticationTest/redirect_to_original_url_after_indirect_login.html").build()).runOn(ORCHESTRATOR);
 
diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_with_parameters_after_direct_login.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_with_parameters_after_direct_login.html
new file mode 100644 (file)
index 0000000..d10513f
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/sessions/logout</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>open</td>
+    <td>/projects?gate=OK&reliability=1&security=1</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForText</td>
+    <td>global-navigation</td>
+    <td>*Log in*</td>
+  </tr>
+  <tr>
+    <td>click</td>
+    <td>link=Log in</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForText</td>
+    <td>content</td>
+    <td>*Log In to SonarQube*</td>
+  </tr>
+  <tr>
+    <td>type</td>
+    <td>id=login</td>
+    <td>admin</td>
+  </tr>
+  <tr>
+    <td>type</td>
+    <td>id=password</td>
+    <td>admin</td>
+  </tr>
+  <tr>
+    <td>clickAndWait</td>
+    <td>commit</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForElementPresent</td>
+    <td>css=.js-user-authenticated</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForText</td>
+    <td>css=.navbar</td>
+    <td>*Administrator*</td>
+  </tr>
+  <tr>
+    <td>assertLocation</td>
+    <td>*/projects?gate=OK&reliability=1&security=1</td>
+    <td></td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
index 9a5399f6e988a8e05016c77dadcbe8265413e2b4..3f1c87f5977045eaf0f29c622acb43ae63d1d9a0 100644 (file)
@@ -67,7 +67,7 @@
 
     $("#login_form").modalForm({
       success: function () {
-        window.location = '<%= h(@return_to) -%>' + $('[name="return_to_anchor"]').val();
+        window.location = '<%= escape_javascript @return_to -%>' + $('[name="return_to_anchor"]').val();
       },
       error: function () {
         $('.alert-flash').addClass('hidden');