blob: 18365215c458aacdc3b668e3a856e1b1fd6390b2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014-2016 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christopher Guindon (Eclipse Foundation)
* Eric Poirier (Eclipse Foundation)
*******************************************************************************/
jQuery(document).ready(function() {
settings = {
message: 'This value is not valid.',
container: 'tooltip',
submitButtons: 'button[type="submit"]',
feedbackIcons: {
valid: 'fa fa-check-square',
invalid: 'fa fa-minus-square',
validating: 'fa fa-refresh'
},
};
settings_field_username = {
username: {
validators: {
notEmpty: {
message: 'Your email address doesn\'t appear valid!'
},
emailAddress: {
message: 'The is not a valid email address.'
}
}
}
};
settings_field_password_login = {
password: {
message: 'Your password is not valid',
validators: {
notEmpty: {
message: 'The password field is required and cannot be empty.'
},
regexp: {
regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
}
}
};
settings_field_password = {
password1: {
message: 'Your password is not valid',
validators: {
notEmpty: {
message: 'The password field is required and cannot be empty.'
},
regexp: {
regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
identical: {
field: 'password2',
message: 'Your passwords do not match!'
}
}
}
};
settings_field_password2 = {
password2: {
message: 'Your password is not valid',
validators: {
notEmpty: {
message: 'The password field is required and cannot be empty.'
},
regexp: {
regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
identical: {
field: 'password1',
message: 'Your passwords do not match!'
}
}
}
};
settings_field_account_password = {
password1: {
message: 'Your password is not valid',
validators: {
stringLength: {
min: 6,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
regexp: {
regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
}
}
};
settings_field_account_password2 = {
password2: {
message: 'Your password is not valid',
validators: {
stringLength: {
min: 6,
message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.'
},
identical: {
field: 'password1',
message: 'Your passwords do not match!'
}
}
}
};
settings_field_first_name = {
fname: {
message: 'The first name is not valid.',
validators: {
notEmpty: {
message: 'The first name is required and cannot be empty.'
},
stringLength: {
min: 2,
max: 30,
message: 'The first name must be more than 2 and less than 30 characters long.'
},
}
}
}
settings_field_last_name = {
lname: {
message: 'The last name is not valid',
validators: {
notEmpty: {
message: 'The last name is required and cannot be empty.'
},
stringLength: {
min: 2,
max: 30,
message: 'The last name must be more than 2 and less than 30 characters long.'
},
}
}
}
settings_field_agree = {
agree: {
message: 'The last name is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'Please agree to Eclipse.org Terms of Use.'
}
}
}
}
settings_changed_employer = {
changed_employer: {
validators: {
notEmpty: {
message: 'You must indicate if you have changed employers in order to save changes to your organization.'
},
}
}
}
settings_field_skill = {
skill: {
message: 'The last name is not valid',
validators: {
between: {
min: 16,
max: 16,
message: 'That is not the right answer!'
}
}
}
}
settings_field_website = {
website: {
message: 'The last name is not valid',
validators: {
uri: {
message: 'The website address is not valid'
}
}
}
}
settings_field_bio = {
bio: {
validators: {
stringLength: {
max: 2000,
message: 'The bio must be less than 2000 characters'
}
}
}
}
settings_field_organization = {
organization: {
validators: {
stringLength: {
max: 255,
message: 'The organization must be less than 255 characters'
}
}
}
}
settings_field_jobtitle = {
jobtitle: {
validators: {
stringLength: {
max: 255,
message: 'The jobtitle must be less than 255 characters'
}
}
}
}
settings_field_interests = {
interests: {
validators: {
stringLength: {
max: 255,
message: 'The interests must be less than 255 characters'
}
}
}
}
settings_field_twitter_handle = {
twitter_handle: {
validators: {
stringLength: {
max: 255,
message: 'The twitter handle must be less than 255 characters'
}
}
}
}
settings_field_github = {
github: {
validators: {
stringLength: {
max: 255,
message: 'The github must be less than 255 characters'
}
}
}
}
settings_field_country = {
country: {
message: 'Please select a country',
validators: {
notEmpty: {
message: 'The country is required and cannot be empty.'
},
stringLength: {
min: 2,
max: 2,
message: 'The country must be 2 characters long.'
},
}
}
}
settings_field_gender = {
gender: {
message: 'The gender is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'Please select a gender.'
}
}
}
}
settings_field_cla_question_1 = {
question_1: {
message: 'Question 1 is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'You must accept Question 1.'
}
}
}
}
settings_field_cla_question_2 = {
question_2: {
message: 'Question 2 is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'You must accept Question 2.'
}
}
}
}
settings_field_cla_question_3 = {
question_3: {
message: 'Question 3 is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'You must accept Question 3.'
}
}
}
}
settings_field_cla_question_4 = {
question_4: {
message: 'Question 4 is not valid',
validators: {
choice: {
min: 1,
max: 1,
message: 'You must accept Question 4.'
}
}
}
}
settings_field_cla_agree = {
cla_agree: {
validators: {
notEmpty: {
message: 'You must enter "I AGREE" in the Electronic Signature field.'
},
stringLength: {
min: 7,
max: 7,
message: 'You must enter "I AGREE" in the Electronic Signature field.'
}
}
}
}
settings_field_cla_employer = {
employer: {
validators: {
notEmpty: {
message: 'You must enter your Employer.'
},
}
}
}
settings_field_cla_address = {
address: {
validators: {
notEmpty: {
message: 'You must enter your Address.'
},
}
}
}
form = {
fields: {}
};
// Forgot my password form
var frm_login_fields = {};
frm_passwd_fields = form;
$.extend(frm_passwd_fields.fields, settings_field_username);
frm_login_settings = $.extend({}, settings, frm_passwd_fields);
$('#frm_passwd').bootstrapValidator(frm_login_settings);
// Create a New Account form
var frm_login_fields = {};
frm_create_account_fields = form;
$.extend(frm_create_account_fields.fields, settings_field_gender, settings_field_country, settings_field_username, settings_field_password, settings_field_password2, settings_field_first_name, settings_field_last_name, settings_field_agree, settings_field_skill);
frm_login_settings = $.extend({}, settings, frm_create_account_fields);
$('#frm_create_account').bootstrapValidator(frm_login_settings);
var frm_login_fields = {};
frm_create_account_fields = form;
$.extend(frm_create_account_fields.fields, settings_field_username, settings_changed_employer, settings_field_password_login, settings_field_account_password, settings_field_account_password2, settings_field_first_name, settings_field_last_name, settings_field_github);
frm_login_settings = $.extend({}, settings, frm_create_account_fields);
$('#frm_accountsettings').bootstrapValidator(frm_login_settings);
var frm_login_fields = {};
frm_profile_fields = form;
$.extend(frm_profile_fields.fields, settings_field_gender, settings_field_country, settings_field_website, settings_field_bio, settings_changed_employer, settings_field_organization, settings_field_jobtitle, settings_field_interests, settings_field_twitter_handle);
frm_login_settings = $.extend({}, settings, frm_profile_fields);
$('#frm_profile').bootstrapValidator(frm_login_settings);
var frm_login_fields = {};
frm_cla_fields = form;
$.extend(frm_cla_fields.fields, settings_field_cla_question_1, settings_field_cla_question_2, settings_field_cla_question_3, settings_field_cla_question_4, settings_field_cla_agree, settings_field_cla_employer, settings_field_cla_address);
frm_cla_settings = $.extend({}, settings, frm_cla_fields);
$('#frm_cla').bootstrapValidator(frm_cla_settings);
});