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 function clear_authenticate_error() {
35 document.getElementById('login-authenticate-error').innerHTML = "";
40 <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
41 <div class="well clearfix">
43 <%= raw(Rails.configuration.Workbench.WelcomePageHTML) %>
46 <% when Rails.configuration.Login.Google.Enable %>
47 <% when Rails.configuration.Login.OpenIDConnect.Enable %>
48 <% when Rails.configuration.Login.SSO.Enable %>
49 <div class="pull-right">
50 <%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "btn btn-primary" do %>
51 Log in to <%= Rails.configuration.Workbench.SiteName %>
52 <i class="fa fa-fw fa-arrow-circle-right"></i>
55 <% when Rails.configuration.Login.PAM.Enable %>
56 <% when Rails.configuration.Login.LDAP.Enable %>
57 <% when Rails.configuration.Login.Test.Enable %>
58 <form id="login-form-tag" onsubmit="controller_password_authenticate(event)">
59 <p>username <input type="text" class="form-control" name="login-username"
60 value="" id="login-username" style="width: 50%"
61 oninput="clear_authenticate_error()"></input></p>
62 <p>password <input type="password" class="form-control" name="login-password" value=""
63 id="login-password" style="width: 50%"
64 oninput="clear_authenticate_error()"></input></p>
65 <input type="hidden" name="return_to" value="<%= "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
66 <span style="color: red"><p id="login-authenticate-error"></p></span>
67 <button type="submit" class="btn btn-primary">Login</button>