[ARVADOS] updated: 8d9db88641ada8ecd5400fe4affd9b90647c5d3a

git at public.curoverse.com git at public.curoverse.com
Thu Nov 12 16:12:31 EST 2015


Summary of changes:
 apps/workbench/app/views/layouts/body.html.erb       |  4 ++--
 .../test/controllers/application_controller_test.rb  | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

       via  8d9db88641ada8ecd5400fe4affd9b90647c5d3a (commit)
       via  1df49e868dd28baf47ea01a45d4cb421b97ec0aa (commit)
      from  97bc18eee0a50a4bc0209932c26ab44e51b4836b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 8d9db88641ada8ecd5400fe4affd9b90647c5d3a
Merge: 97bc18e 1df49e8
Author: Brett Smith <brett at curoverse.com>
Date:   Thu Nov 12 16:12:28 2015 -0500

    Merge branch '6846-workbench-top-nav-login-returns-wip'
    
    Closes #6846, #7739.


commit 1df49e868dd28baf47ea01a45d4cb421b97ec0aa
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Nov 9 12:02:25 2015 -0500

    6846: Workbench navigation bar login returns user to the same page.

diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 22ccc2f..acb056e 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -138,10 +138,10 @@
               <li><%= link_to 'Browse public projects', "/projects/public" %></li>
             <% end %>
             <li class="dropdown hover-dropdown login-menu">
-              <a href="<%= arvados_api_client.arvados_login_url(return_to: root_url) %>">Log in</a>
+              <a href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">Log in</a>
               <ul class="dropdown-menu">
                 <li>
-                  <a href="<%= arvados_api_client.arvados_login_url(return_to: root_url) %>">
+                  <a href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">
                     <span class="fa fa-lg fa-sign-in"></span>
                     <p style="margin-left: 1.6em; margin-top: -1.35em; margin-bottom: 0em; margin-right: 0.5em;">Log in or register with<br/>any Google account</p>
                   </a>
diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index 15d52da..ef2a989 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -334,6 +334,26 @@ class ApplicationControllerTest < ActionController::TestCase
     assert_response 404
   end
 
+  [".navbar .login-menu a",
+   ".navbar .login-menu .dropdown-menu a"
+  ].each do |css_selector|
+    test "login link at #{css_selector.inspect} includes return_to param" do
+      # Without an anonymous token, we're immediately redirected to login.
+      Rails.configuration.anonymous_user_token =
+        api_fixture("api_client_authorizations", "anonymous", "api_token")
+      @controller = ProjectsController.new
+      test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz"
+      get(:show, {id: test_uuid})
+      login_link = css_select(css_selector).first
+      assert_not_nil(login_link, "failed to select login link")
+      login_href = URI.unescape(login_link.attributes["href"])
+      # The parameter needs to include the full URL to work.
+      assert_includes(login_href, "://")
+      assert_match(/[\?&]return_to=[^&]*\/projects\/#{test_uuid}(&|$)/,
+                   login_href)
+    end
+  end
+
   test "Workbench returns 4xx when API server is unreachable" do
     # We're really testing ApplicationController's render_exception.
     # Our primary concern is that it doesn't raise an error and

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list