Fix: maestro html ES6 -> ES5

This commit is contained in:
2018-09-15 13:51:48 +09:00
parent 53e3dbb3bc
commit 753325d84a
9 changed files with 585 additions and 613 deletions
+64 -69
View File
@@ -1,88 +1,83 @@
class AccountValidator {
function AccountValidator() {
this.patternMaestroID = /^[A-Za-z가-힣]{1}[A-Za-z0-9가-힣]{2,19}$/;
this.patternMaestroPW = /^[A-Za-z0-9]{4,16}$/;
constructor() {
this.patternMaestroID = /^[A-Za-z가-힣]{1}[A-Za-z0-9가-힣]{2,19}$/;
this.patternMaestroPW = /^[A-Za-z0-9]{4,16}$/;
this.patternPlayerID = /^[A-Za-z0-9가-힣-_]{1,8}$/;
this.patternPlayerPW = /^[0-9]{4,6}$/;
}
this.patternPlayerID = /^[A-Za-z0-9가-힣-_]{1,8}$/;
this.patternPlayerPW = /^[0-9]{4,6}$/;
}
// maestro
AccountValidator.prototype.isValidMaestroID = function(textID) {
if(!this.patternMaestroID.test(textID))
return false;
// maestro
isValidMaestroID(textID) {
if(!this.patternMaestroID.test(textID))
return false;
return true;
}
return true;
}
messageForInvalidMaestroID(textID) {
if(textID.length < AccountValidator.MAESTRO_ID_LENGTH_MINIMUM)
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textID.length > AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM)
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else if(!(/^[A-Za-z]/.test(textID)))
return "마에스트로 계정명은 알파벳으로 시작해야 합니다.";
else if((/[^\w]/g).test(textID))
return "마에스트로 계정명은 알파벳과 숫자로만 적어주세요.";
}
AccountValidator.prototype.messageForInvalidMaestroID = function(textID) {
if(textID.length < AccountValidator.MAESTRO_ID_LENGTH_MINIMUM)
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textID.length > AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM)
return "마에스트로 계정명은 " + AccountValidator.MAESTRO_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else if(!(/^[A-Za-z]/.test(textID)))
return "마에스트로 계정명은 알파벳으로 시작해야 합니다.";
else if((/[^\w]/g).test(textID))
return "마에스트로 계정명은 알파벳과 숫자로만 적어주세요.";
}
isValidMaestroPW(textPW) {
if(!this.patternMaestroPW.test(textPW))
return false;
AccountValidator.prototype.isValidMaestroPW = function(textPW) {
if(!this.patternMaestroPW.test(textPW))
return false;
return true;
}
return true;
}
messageForInvalidMaestroPW(textPW) {
console.log(textPW);
if(textPW.length < AccountValidator.MAESTRO_PW_LENGTH_MINIMUM)
return "마에스트로의 암호는 " + AccountValidator.MAESTRO_PW_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textPW.length > AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM)
return "마에스트로의 암호는 " + AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else if((/[^\w]/g).test(textPW))
return "마에스트로의 암호는 알파벳과 숫자로만 적어주세요.";
else
return "???";
}
AccountValidator.prototype.messageForInvalidMaestroPW = function(textPW) {
console.log(textPW);
if(textPW.length < AccountValidator.MAESTRO_PW_LENGTH_MINIMUM)
return "마에스트로의 암호는 " + AccountValidator.MAESTRO_PW_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textPW.length > AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM)
return "마에스트로의 암호는 " + AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else if((/[^\w]/g).test(textPW))
return "마에스트로의 암호는 알파벳과 숫자로만 적어주세요.";
else
return "???";
}
// player
isValidPlayerID(textID) {
if(!this.patternPlayerID.test(textID))
return false;
// player
AccountValidator.prototype.isValidPlayerID = function(textID) {
if(!this.patternPlayerID.test(textID))
return false;
return true;
}
return true;
}
messageForInvalidPlayerID(textID) {
if(textID.length < Number(AccountValidator.Player_ID_LENGTH_MINIMUM))
return "학생 이름은 " + AccountValidator.Player_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textID.length > Number(AccountValidator.PLAYER_ID_LENGTH_MAXIMUM))
return "학생 이름은 " + AccountValidator.PLAYER_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else // if((/[^A-Za-z0-9가-힣-_]/g).test(textID))
return "학생 이름 입력 가능한 문자는 [ 한글, 알파벳, 숫자, -, _ ] 입니다.";
}
AccountValidator.prototype.messageForInvalidPlayerID = function(textID) {
if(textID.length < Number(AccountValidator.Player_ID_LENGTH_MINIMUM))
return "학생 이름은 " + AccountValidator.Player_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다.";
else if(textID.length > Number(AccountValidator.PLAYER_ID_LENGTH_MAXIMUM))
return "학생 이름은 " + AccountValidator.PLAYER_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다.";
else // if((/[^A-Za-z0-9가-힣-_]/g).test(textID))
return "학생 이름 입력 가능한 문자는 [ 한글, 알파벳, 숫자, -, _ ] 입니다.";
}
isValidPlayerPW(textPW) {
if(!this.patternPlayerPW.test(textPW))
return false;
return true;
}
messageForInvalidPlayerPW(textPW) {
if(textPW.length < Number(AccountValidator.PLAYER_PW_LENGTH_MINIMUM))
return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MINIMUM + "글자 이상의 숫자로 입력해 주세요.";
else if(textPW.length > Number(AccountValidator.PLAYER_PW_LENGTH_MAXIMUM))
return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MAXIMUM + "글자 이하의 숫자로 입력해 주세요.";
else
return "학생 입장 번호는 4~6자리 숫자로 입력해 주세요.";
}
AccountValidator.prototype.isValidPlayerPW = function(textPW) {
if(!this.patternPlayerPW.test(textPW))
return false;
return true;
}
AccountValidator.prototype.messageForInvalidPlayerPW = function(textPW) {
if(textPW.length < Number(AccountValidator.PLAYER_PW_LENGTH_MINIMUM))
return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MINIMUM + "글자 이상의 숫자로 입력해 주세요.";
else if(textPW.length > Number(AccountValidator.PLAYER_PW_LENGTH_MAXIMUM))
return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MAXIMUM + "글자 이하의 숫자로 입력해 주세요.";
else
return "학생 입장 번호는 4~6자리 숫자로 입력해 주세요.";
}