From 54b8bdb3a28720e60cc922c8f67453d32e7ed129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Thu, 19 Jul 2018 16:39:07 +0900 Subject: [PATCH] Add: check player name, enterCode before add player --- src/web/js/lib/account_validator.js | 27 +++--- src/web/maestro/main_menu.html | 1 + .../module/maestro_section_add_player.html | 33 ++++++++ src/web/module/maestro_section_register.html | 14 ++-- src/web/module/maestro_section_search.html | 14 ---- src/web/server/player/add_player.php | 82 +++++++++++++++++-- src/web/server/player/delete_player.php | 37 ++++++++- src/web/sql/make_db.sql | 6 +- 8 files changed, 163 insertions(+), 51 deletions(-) diff --git a/src/web/js/lib/account_validator.js b/src/web/js/lib/account_validator.js index d654435..dc276d9 100644 --- a/src/web/js/lib/account_validator.js +++ b/src/web/js/lib/account_validator.js @@ -57,14 +57,12 @@ class AccountValidator { } messageForInvalidPlayerID(textID) { - if(textID.length < AccountValidator.Player_ID_LENGTH_MINIMUM) - return "마에스트로 계정명은 " + AccountValidator.Player_ID_LENGTH_MINIMUM + "글자 이상이어야 합니다."; - else if(textID.length > AccountValidator.Player_ID_LENGTH_MAXIMUM) - return "마에스트로 계정명은 " + AccountValidator.Player_ID_LENGTH_MAXIMUM + "글자 이하이어야 합니다."; - else if(!(/^[A-Za-z]/.test(textID))) - return "마에스트로 계정명은 알파벳으로 시작해야 합니다."; - else if((/[^\w]/g).test(textID)) - return "마에스트로 계정명은 알파벳과 숫자로만 적어주세요."; + 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 "학생 이름 입력 가능한 문자는 [ 한글, 알파벳, 숫자, -, _ ] 입니다."; } @@ -76,15 +74,12 @@ class AccountValidator { } messageForInvalidPlayerPW(textPW) { - console.log(textPW); - if(textPW.length < AccountValidator.Player_PW_LENGTH_MINIMUM) - return "마에스트로의 암호는 " + AccountValidator.Player_PW_LENGTH_MINIMUM + "글자 이상이어야 합니다."; - else if(textPW.length > AccountValidator.Player_PW_LENGTH_MAXIMUM) - return "마에스트로의 암호는 " + AccountValidator.Player_PW_LENGTH_MAXIMUM + "글자 이하이어야 합니다."; - else if((/[^\w]/g).test(textPW)) - return "마에스트로의 암호는 알파벳과 숫자로만 적어주세요."; + 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 "???"; + return "학생 입장 번호는 4~6자리 숫자로 입력해 주세요."; } diff --git a/src/web/maestro/main_menu.html b/src/web/maestro/main_menu.html index fe330b3..709cc6e 100644 --- a/src/web/maestro/main_menu.html +++ b/src/web/maestro/main_menu.html @@ -11,6 +11,7 @@ + diff --git a/src/web/module/maestro_section_add_player.html b/src/web/module/maestro_section_add_player.html index 3af56b4..24b6018 100644 --- a/src/web/module/maestro_section_add_player.html +++ b/src/web/module/maestro_section_add_player.html @@ -1,5 +1,7 @@  diff --git a/src/web/module/maestro_section_register.html b/src/web/module/maestro_section_register.html index 163629b..632ac94 100644 --- a/src/web/module/maestro_section_register.html +++ b/src/web/module/maestro_section_register.html @@ -27,7 +27,7 @@