Skip to content
Snippets Groups Projects
Commit 5a0cb4a9 authored by rswindell's avatar rswindell
Browse files

Fix birthdate format:

Forcing DD-MM-YY format was wrong for a couple of reasons.
Either MM/DD/YY or DD/MM/YY is valid and which is valid is based on sysop
configuration (European date format enabled or not). I know this is kind of
lame, but that's the current legacy design of Synchronet.
parent 1f565ea6
Branches
Tags
No related merge requests found
......@@ -331,9 +331,10 @@ var validateNewUserForm = function() {
sexCheck++;
}
if(theForm.elements[e].id == 'birthDate') {
if(theForm.elements[e].value.match(/\d\d-\d\d-\d\d/) == null) {
if(theForm.elements[e].value.match(/\d\d\/\d\d\/\d\d/) == null) {
theForm.elements[e].style.backgroundColor = '#FA5882';
document.getElementById(theForm.elements[e].id + 'Error').innerHTML = 'Invalid date (DD-MM-YY)';
document.getElementById(theForm.elements[e].id + 'Error').innerHTML = format('Invalid date (%s)'
,(system.settings&SYS_EURODATE) ? "DD/MM/YY" : "MM/DD/YY");
returnValue = false;
} else {
theForm.elements[e].style.backgroundColor = '#82FA58';
......
......@@ -86,8 +86,8 @@ if(http_request.query.hasOwnProperty('font')) {
}
if(system.newuser_questions&UQ_BIRTH) {
if(!http_request.query.hasOwnProperty('birthDate') || http_request.query.birthDate.toString().match(/\d\d-\d\d-\d\d/) == null)
failString += '- Birth date not provided<br />';
if(!http_request.query.hasOwnProperty('birthDate') || http_request.query.birthDate.toString().match(/\d\d\/\d\d\/\d\d/) == null)
failString += '- Birthdate not provided<br />';
else
newUserObject.birthdate = http_request.query.birthDate.toString();
}
......@@ -159,7 +159,7 @@ if(http_request.query.hasOwnProperty('font')) {
if(system.newuser_questions&UQ_SEX)
print("Sex: <input class='border font' type='radio' name='sex' id='sex' value='m' />M <input class='border font' type='radio' name='sex' id='sex' value='f' />F <span id='sexError'></span><br /><br />"); // lol
if(system.newuser_questions&UQ_BIRTH)
print("Birthdate DD-MM-YY:<br /><input class='border font' type='text' size='8' name='birthDate' id='birthDate' /> <span id='birthDateError'></span><br /><br />");
print(format("Birthdate (%s):<br /><input class='border font' type='text' size='8' name='birthDate' id='birthDate' /> <span id='birthDateError'></span><br /><br />", (system.settings&SYS_EURODATE) ? "DD/MM/YY" : "MM/DD/YY"));
if(system.newuser_questions&UQ_COMPANY)
print("Company:<br /><input class='border font' type='text' size='30' name='company' id='company' /> <span id='companyError'></span><br /><br />");
if(system.newuser_questions&UQ_NONETMAIL == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment