[arvados] created: 2.1.0-3212-g8608a7502

git repository hosting git at public.arvados.org
Fri Dec 16 19:38:08 UTC 2022


        at  8608a75029e1b29c0eacf53532baded917d73a96 (commit)


commit 8608a75029e1b29c0eacf53532baded917d73a96
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Dec 16 14:36:50 2022 -0500

    19880: Password based login fix
    
    Now sends user to wb1 front page instead of controller login endpoint
    that returns an error.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb
index 47fcc4ce5..25a4e74b7 100644
--- a/apps/workbench/app/models/arvados_api_client.rb
+++ b/apps/workbench/app/models/arvados_api_client.rb
@@ -235,19 +235,35 @@ class ArvadosApiClient
   end
 
   def arvados_login_url(params={})
+    case
+    when Rails.configuration.Login.PAM.Enable,
+         Rails.configuration.Login.LDAP.Enable,
+         Rails.configuration.Login.Test.Enable
+
+      uri = URI.parse(Rails.configuration.Services.Workbench1.ExternalURL.to_s)
+      uri.path = "/users/welcome"
+      uri.query = URI.encode_www_form(params)
+    else
+      uri = URI.parse(Rails.configuration.Services.Controller.ExternalURL.to_s)
+      if Rails.configuration.testing_override_login_url
+        uri = URI(Rails.configuration.testing_override_login_url)
+      end
+      uri.path = "/login"
+      uri.query = URI.encode_www_form(params)
+    end
+    uri.to_s
+  end
+
+  def arvados_logout_url(params={})
     uri = URI.parse(Rails.configuration.Services.Controller.ExternalURL.to_s)
     if Rails.configuration.testing_override_login_url
       uri = URI(Rails.configuration.testing_override_login_url)
     end
-    uri.path = "/login"
+    uri.path = "/logout"
     uri.query = URI.encode_www_form(params)
     uri.to_s
   end
 
-  def arvados_logout_url(params={})
-    arvados_login_url(params).sub('/login','/logout')
-  end
-
   def arvados_v1_base
     # workaround Ruby 2.3 bug, can't duplicate URI objects
     # https://github.com/httprb/http/issues/388
diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb
index 92fd6dad4..69009a03d 100644
--- a/apps/workbench/app/views/users/welcome.html.erb
+++ b/apps/workbench/app/views/users/welcome.html.erb
@@ -57,7 +57,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
           <p>password <input type="password" class="form-control" name="login-password" value=""
 			     id="login-password" style="width: 50%"
 			     oninput="clear_authenticate_error()"></input></p>
-        <input type="hidden" name="return_to" value="<%= "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
+        <input type="hidden" name="return_to" value="<%= params[:return_to] || "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
         <span style="color: red"><p id="login-authenticate-error"></p></span>
         <button type="submit" class="btn btn-primary">Log in</button>
         </form>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list