1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 <% content_for :breadcrumbs do raw '<!-- -->' end %>
7 <%= javascript_tag do %>
8 async function controller_password_authenticate(event) {
10 document.getElementById('login-authenticate-error').innerHTML = '';
11 const resp = await fetch('<%= "#{Rails.configuration.Services.Controller.ExternalURL}" %>arvados/v1/users/authenticate', {
14 headers: {'Content-Type': 'application/json'},
15 body: JSON.stringify({
16 username: document.getElementById('login-username').value,
17 password: document.getElementById('login-password').value,
21 const respj = await resp.json()
22 document.getElementById('login-authenticate-error').innerHTML = `<p>${respj.errors[0]}</p>`;
25 var redir = document.getElementById('login-return-to').value
26 if (redir.indexOf('?') > 0) {
31 const respj = await resp.json()
32 document.location = redir + "api_token=v2/" + respj.uuid + "/" + respj.api_token
34 // document.getElementById('login-form-tag').
38 <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
39 <div class="well clearfix">
41 <%= raw(Rails.configuration.Workbench.WelcomePageHTML) %>
44 <% when Rails.configuration.Login.Google.Enable %>
45 <% when Rails.configuration.Login.OpenIDConnect.Enable %>
46 <% when Rails.configuration.Login.SSO.Enable %>
47 <div class="pull-right">
48 <%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "btn btn-primary" do %>
49 Log in to <%= Rails.configuration.Workbench.SiteName %>
50 <i class="fa fa-fw fa-arrow-circle-right"></i>
53 <% when Rails.configuration.Login.PAM.Enable %>
54 <% when Rails.configuration.Login.LDAP.Enable %>
55 <% when Rails.configuration.Login.Test.Enable %>
56 <form id="login-form-tag" onsubmit="controller_password_authenticate(event)">
57 <p>username <input type="text" class="form-control" name="login-username" value="" id="login-username" style="width: 50%"></input></p>
58 <p>password <input type="password" class="form-control" name="login-password" value="" id="login-password" style="width: 50%"></input></p>
59 <input type="hidden" name="return_to" value="<%= "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
60 <p id="login-authenticate-error"></p>
61 <button type="submit" class="btn btn-primary">Login</button>