X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ec34701537a4de8f7aff3b7f91b4402367ebb22a..5e9787f914dd1a2f762ae7a653fe8dda36f8f555:/apps/workbench/app/views/users/add_ssh_key_popup.js.erb diff --git a/apps/workbench/app/views/users/add_ssh_key_popup.js.erb b/apps/workbench/app/views/users/add_ssh_key_popup.js.erb index 808edd7502..eba89603fc 100644 --- a/apps/workbench/app/views/users/add_ssh_key_popup.js.erb +++ b/apps/workbench/app/views/users/add_ssh_key_popup.js.erb @@ -1,35 +1,8 @@ -$("#add-ssh-key-modal-window").html("<%= escape_javascript(render partial: 'add_ssh_key_popup') %>"); - -// disable the submit button on load -var $input = $('input:text'), -$register = $('#register'); - -var name_value = document.forms["add_new_key_form"]["name"].value; -var public_key_value = document.forms["add_new_key_form"]["public_key"].value; -if (public_key_value == null || public_key_value == "") { - $register.attr('disabled', true); -} +<%# Copyright (C) The Arvados Authors. All rights reserved. -// capture events to enable submit button when applicable -$input.on('keyup paste mouseleave onblur', function() { - var trigger = false; +SPDX-License-Identifier: AGPL-3.0 %> - var name_value = document.forms["add_new_key_form"]["name"].value; - var public_key_value = document.forms["add_new_key_form"]["public_key"].value; - - var publicKeyRegExp = /^ssh-(rsa|dss) [A-Za-z0-9+\/=\+]+\b/; - var validKey = false; - - if (publicKeyRegExp.test(public_key_value )) { - validKey = true; - } - - if (public_key_value == null || public_key_value == "" || !validKey){ - trigger = true; - } - - trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled'); -}); +$("#add-ssh-key-modal-window").html("<%= escape_javascript(render partial: 'add_ssh_key_popup') %>"); // reset form input fields, for the next time around function reset_form() {