1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 $("#user-setup-modal-window").html("<%= escape_javascript(render partial: 'setup_popup') %>");
7 // disable the submit button on load
8 var $input = $('input:text'),
9 $register = $('#register');
11 var email_disabled = document.forms["setup_form"]["email"].disabled;
12 var email_value = document.forms["setup_form"]["email"].value;
13 var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
14 if ((email_disabled == false) && (email_value == null || email_value == "" ||
15 prefix_value == null || prefix_value == "")) {
16 $register.prop('disabled', true);
19 // capture events to enable submit button when applicable
20 $input.on('keyup paste mouseleave', function() {
23 var email_disabled = document.forms["setup_form"]["email"].disabled;
24 var email_value = document.forms["setup_form"]["email"].value;
25 var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
27 var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
28 var validEmail = false;
30 if (emailRegExp.test(email_value )) {
34 if ((email_disabled == false) && (!validEmail || email_value == null ||
35 email_value == "" || prefix_value == null || prefix_value == "")){
39 $register.prop('disabled', trigger);
42 // reset form input fields, for the next time around
43 function reset_form() {
45 $('#openid_prefix').val("");
46 $('#repo_name').val("");