[ARVADOS] created: 2.1.0-790-gc426bf926

Git user git at public.arvados.org
Thu May 13 21:27:53 UTC 2021


        at  c426bf92611cff8b5590d5bf77359ea241d82dcb (commit)


commit c426bf92611cff8b5590d5bf77359ea241d82dcb
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Thu May 13 17:27:28 2021 -0400

    17499: Support username/password login on workbench1
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb
index 479e3e1d8..36b457af0 100644
--- a/apps/workbench/app/views/users/welcome.html.erb
+++ b/apps/workbench/app/views/users/welcome.html.erb
@@ -4,42 +4,64 @@ SPDX-License-Identifier: AGPL-3.0 %>
 
 <% content_for :breadcrumbs do raw '<!-- -->' end %>
 
+<%= javascript_tag do %>
+      async function controller_password_authenticate(event) {
+        event.preventDefault()
+	document.getElementById('login-authenticate-error').innerHTML = '';
+	const resp = await fetch('<%= "#{Rails.configuration.Services.Controller.ExternalURL}" %>arvados/v1/users/authenticate', {
+	  method: 'POST',
+
+	  headers: {'Content-Type': 'application/json'},
+	  body: JSON.stringify({
+	    username: document.getElementById('login-username').value,
+	    password: document.getElementById('login-password').value,
+	  }),
+	})
+        if (!resp.ok) {
+          const respj = await resp.json()
+	  document.getElementById('login-authenticate-error').innerHTML = `<p>${respj.errors[0]}</p>`;
+	  return
+	}
+	var redir = document.getElementById('login-return-to').value
+	if (redir.indexOf('?') > 0) {
+	  redir += '&'
+	} else {
+	  redir += '?'
+	}
+        const respj = await resp.json()
+	document.location = redir + "api_token=v2/" + respj.uuid + "/" + respj.api_token
+      }
+      // document.getElementById('login-form-tag').
+<% end %>
+
 <div class="row">
   <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
     <div class="well clearfix">
-      <%= image_tag "dax.png", style: "width: 112px; height: 150px; margin-right: 2em", class: 'pull-left' %>
-
-      <h3 style="margin-top:0">Please log in.</h3>
-
-      <p>
-
-        The "Log in" button below will show you a Google sign-in page.
-        After you assure Google that you want to log in here with your
-        Google account, you will be redirected back here to
-        <%= Rails.configuration.Workbench.SiteName %>.
 
-      </p><p>
+      <%= raw(Rails.configuration.Workbench.WelcomePageHTML) %>
 
-        If you have never used <%= Rails.configuration.Workbench.SiteName %>
-        before, logging in for the first time will automatically
-        create a new account.
-
-      </p><p>
-
-        <i><%= Rails.configuration.Workbench.SiteName %> uses your name and
-          email address only for identification, and does not retrieve
-          any other personal information from Google.</i>
-
-      </p>
-        <%# Todo: add list of external authentications providers to
-            discovery document, then generate the option list here. Right
-            now, don't provide 'auth_provider' to get the default one. %>
+      <% case %>
+      <% when Rails.configuration.Login.Google.Enable %>
+      <% when Rails.configuration.Login.OpenIDConnect.Enable %>
+      <% when Rails.configuration.Login.SSO.Enable %>
         <div class="pull-right">
           <%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "btn btn-primary" do %>
           Log in to <%= Rails.configuration.Workbench.SiteName %>
           <i class="fa fa-fw fa-arrow-circle-right"></i>
           <% end %>
         </div>
+      <% when Rails.configuration.Login.PAM.Enable %>
+      <% when Rails.configuration.Login.LDAP.Enable %>
+      <% when Rails.configuration.Login.Test.Enable %>
+        <form id="login-form-tag" onsubmit="controller_password_authenticate(event)">
+	<p>username <input type="text" class="form-control" name="login-username" value="" id="login-username" style="width: 50%"></input></p>
+	<p>password <input type="password" class="form-control" name="login-password" value="" id="login-password" style="width: 50%"></input></p>
+        <input type="hidden" name="return_to" value="<%= "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
+	<p id="login-authenticate-error"></p>
+	<button type="submit" class="btn btn-primary">Login</button>
+        </form>
+      <% end %>
+
     </div>
   </div>
 </div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list