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 function controller_password_authenticate(event) {
10 document.getElementById('login-authenticate-error').innerHTML = '';
11 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,
19 }).then(function(resp) {
21 resp.json().then(function(respj) {
22 document.getElementById('login-authenticate-error').innerHTML = "<p>"+respj.errors[0]+"</p>";
27 var redir = document.getElementById('login-return-to').value
28 if (redir.indexOf('?') > 0) {
33 resp.json().then(function(respj) {
34 document.location = redir + "api_token=v2/" + respj.uuid + "/" + respj.api_token;
38 function clear_authenticate_error() {
39 document.getElementById('login-authenticate-error').innerHTML = "";
44 <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
45 <div class="well clearfix">
47 <%= raw(Rails.configuration.Workbench.WelcomePageHTML) %>
50 <% when Rails.configuration.Login.PAM.Enable,
51 Rails.configuration.Login.LDAP.Enable,
52 Rails.configuration.Login.Test.Enable %>
53 <form id="login-form-tag" onsubmit="controller_password_authenticate(event)">
54 <p>username <input type="text" class="form-control" name="login-username"
55 value="" id="login-username" style="width: 50%"
56 oninput="clear_authenticate_error()"></input></p>
57 <p>password <input type="password" class="form-control" name="login-password" value=""
58 id="login-password" style="width: 50%"
59 oninput="clear_authenticate_error()"></input></p>
60 <input type="hidden" name="return_to" value="<%= params[:return_to] || "#{Rails.configuration.Services.Workbench1.ExternalURL}" %>" id="login-return-to">
61 <span style="color: red"><p id="login-authenticate-error"></p></span>
62 <button type="submit" class="btn btn-primary">Log in</button>
65 <div class="pull-right">
66 <%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "btn btn-primary" do %>
67 Log in to <%= Rails.configuration.Workbench.SiteName %>
68 <i class="fa fa-fw fa-arrow-circle-right"></i>