X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8a504ad561c1ffbafee8a7bc8da551f9d4b9a29e..6d1c41d6fd83824669cd1a6d714ea6da1ae7ab4c:/apps/workbench/app/views/users/welcome.html.erb diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb index f23daa7690..69009a03d4 100644 --- a/apps/workbench/app/views/users/welcome.html.erb +++ b/apps/workbench/app/views/users/welcome.html.erb @@ -1,41 +1,75 @@ -<% content_for :breadcrumbs do raw '' end %> - -
+<% content_for :breadcrumbs do raw '' end %> - 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.site_name %>. +<%= javascript_tag do %> + function controller_password_authenticate(event) { + event.preventDefault() + document.getElementById('login-authenticate-error').innerHTML = ''; + 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, + }), + }).then(function(resp) { + if (!resp.ok) { + resp.json().then(function(respj) { + document.getElementById('login-authenticate-error').innerHTML = "
"+respj.errors[0]+"
"; + }); + return; + } - If you have never used <%= Rails.configuration.site_name %> - before, logging in for the first time will automatically - create a new account. + var redir = document.getElementById('login-return-to').value + if (redir.indexOf('?') > 0) { + redir += '&' + } else { + redir += '?' + } + resp.json().then(function(respj) { + document.location = redir + "api_token=v2/" + respj.uuid + "/" + respj.api_token; + }); + }); + } + function clear_authenticate_error() { + document.getElementById('login-authenticate-error').innerHTML = ""; + } +<% end %> -+