Add: Email validator
This commit is contained in:
@@ -6,6 +6,8 @@ function AccountValidator() {
|
|||||||
this.patternPlayerPW = /^[0-9]{2,8}$/;
|
this.patternPlayerPW = /^[0-9]{2,8}$/;
|
||||||
|
|
||||||
this.patternLicenseTimerPW = /^[0-9]{2,8}$/;
|
this.patternLicenseTimerPW = /^[0-9]{2,8}$/;
|
||||||
|
|
||||||
|
this.patternEmailAddress = /([a-zA-Z0-9]+)([+\_\.\-{1}])?([a-zA-Z0-9]+)\@([a-zA-Z0-9]+)([\.])([a-zA-Z\.]+)/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +106,19 @@ AccountValidator.prototype.messageForInvalidLicenseTimerPassword = function(text
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// email ID
|
||||||
|
AccountValidator.prototype.isValidEmailAddress = function(email) {
|
||||||
|
if(!this.patternEmailAddress.test(email))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountValidator.prototype.messageForInvalidEmailAddress = function(email) {
|
||||||
|
return "유효하지 않은 이메일 주소입니다. 올바른 이메일 주소를 입력해주세요.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AccountValidator.MAESTRO_ID_LENGTH_MINIMUM = 4;
|
AccountValidator.MAESTRO_ID_LENGTH_MINIMUM = 4;
|
||||||
|
|||||||
@@ -76,6 +76,13 @@ function onErrorMaestroPW(message) {
|
|||||||
$("#password").focus();
|
$("#password").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onErrorEmailAddress(message) {
|
||||||
|
showErrorMessage(message, "error");
|
||||||
|
|
||||||
|
$("#email").focus();
|
||||||
|
$("#email").select();
|
||||||
|
}
|
||||||
|
|
||||||
function checkData() {
|
function checkData() {
|
||||||
maestroName = $("#maestro_name").val();
|
maestroName = $("#maestro_name").val();
|
||||||
if(maestroName.length === 0) {
|
if(maestroName.length === 0) {
|
||||||
@@ -104,18 +111,21 @@ function checkData() {
|
|||||||
showErrorMessage("이메일을 입력해 주세요.", "error");
|
showErrorMessage("이메일을 입력해 주세요.", "error");
|
||||||
$("#email").focus();
|
$("#email").focus();
|
||||||
return;
|
return;
|
||||||
|
} else if(!accountValidator.isValidEmailAddress(email)) {
|
||||||
|
onErrorEmailAddress(accountValidator.messageForInvalidEmailAddress(email));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selctedObject = $("input[name=account_type_radio]:checked");
|
var selctedObject = $("input[name=account_type_radio]:checked");
|
||||||
selectedAccountTypeValue = selctedObject.val();
|
selectedAccountTypeValue = selctedObject.val();
|
||||||
if(selectedAccountTypeValue === undefined) {
|
if(selectedAccountTypeValue === undefined) {
|
||||||
showErrorMessage("학생 수를 선택해 주세요. (※ 모두 유료 결제를 하셔야 하는 서비스입니다)", "error");
|
showErrorMessage("학생 수를 선택해 주세요. (※ 계정 등록에 필요한 결제 비용도 함께 확인해주세요)", "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isCheckAcceptClauses = $("#check_accept_clauses").is(":checked");
|
var isCheckAcceptClauses = $("#check_accept_clauses").is(":checked");
|
||||||
if(!isCheckAcceptClauses) {
|
if(!isCheckAcceptClauses) {
|
||||||
showErrorMessage("약관을 읽고, 위에 있는 체크 버튼을 눌러 주세요.", "error");
|
showErrorMessage("약관 내용을 살펴보신 후, [등록 신청] 버튼 바로 위에 있는 약관 동의 항목을 체크해주세요.", "error");
|
||||||
$("#check_accept_clauses").focus();
|
$("#check_accept_clauses").focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user