+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
<% content_for :breadcrumbs do raw '<!-- -->' end %>
-<%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
-<h1>Hi there! Please log in to use <%= Rails.configuration.site_name %>.</h1>
-<div class="row-fluid">
- <div class="col span8" style="margin-top: 1em">
+<%= 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">
- <p>When you click on the button below you will be taken to a Google sign-in page.
- After entering your information, you will be redirected back to <%= Rails.configuration.site_name %>
- If you have never used <%= Rails.configuration.site_name %> before, logging in for the first
- time will also create a new user account. <%= Rails.configuration.site_name %> uses your name and
- email address from Google services only for identification, and can not access any personal information
- beyond that.
- </p>
- <p>
- <a class="pull-right btn btn-primary" href="<%= $arvados_api_client.arvados_login_url(return_to: request.url) %>">
- Click here to log in to <%= Rails.configuration.site_name %> with a Google account</a>
- </p>
+
+ <%= raw(Rails.configuration.Workbench.WelcomePageHTML) %>
+
+ <% 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>
-
-