Fix: player password 2~6 digits
This commit is contained in:
@@ -3,7 +3,7 @@ function AccountValidator() {
|
||||
this.patternMaestroPW = /^[A-Za-z0-9]{4,16}$/;
|
||||
|
||||
this.patternPlayerID = /^[A-Za-z0-9가-힣-_]{1,8}$/;
|
||||
this.patternPlayerPW = /^[0-9]{4,6}$/;
|
||||
this.patternPlayerPW = /^[0-9]{2,6}$/;
|
||||
}
|
||||
|
||||
// maestro
|
||||
@@ -73,11 +73,11 @@ AccountValidator.prototype.isValidPlayerPW = function(textPW) {
|
||||
|
||||
AccountValidator.prototype.messageForInvalidPlayerPW = function(textPW) {
|
||||
if(textPW.length < Number(AccountValidator.PLAYER_PW_LENGTH_MINIMUM))
|
||||
return "학생 입장 번호는 " + 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 + "글자 이하의 숫자로 입력해 주세요.";
|
||||
return "학생 입장 번호는 " + AccountValidator.PLAYER_PW_LENGTH_MAXIMUM + "글자 이하의 숫자로만 입력해 주세요.";
|
||||
else
|
||||
return "학생 입장 번호는 4~6자리 숫자로 입력해 주세요.";
|
||||
return "학생 입장 번호는 2~6자리 숫자로 입력해 주세요.";
|
||||
}
|
||||
|
||||
|
||||
@@ -91,5 +91,5 @@ AccountValidator.MAESTRO_PW_LENGTH_MAXIMUM = 16;
|
||||
AccountValidator.PLAYER_ID_LENGTH_MINIMUM = 1;
|
||||
AccountValidator.PLAYER_ID_LENGTH_MAXIMUM = 8;
|
||||
|
||||
AccountValidator.PLAYER_PW_LENGTH_MINIMUM = 4;
|
||||
AccountValidator.PLAYER_PW_LENGTH_MINIMUM = 2;
|
||||
AccountValidator.PLAYER_PW_LENGTH_MAXIMUM = 6;
|
||||
@@ -11,7 +11,6 @@
|
||||
PlayerListNavigator.prototype.updateNavigator = function(activePageNo, lastPageNo) {
|
||||
this.activePageNo = activePageNo;
|
||||
this.lastPageNo = lastPageNo;
|
||||
// this.lastPageNo = Math.ceil( (playerCount + 1) / 10 );
|
||||
|
||||
$(this.pagination).empty();
|
||||
this.makePagination();
|
||||
@@ -41,10 +40,19 @@ PlayerListNavigator.prototype.makePagination = function() {
|
||||
$(this.pagination).append(paginationLeftArrows);
|
||||
|
||||
// numbers
|
||||
for(var pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
|
||||
$(this.pagination).append(
|
||||
'<li class="page-item"><a class="page-link" href="javascript:void(0);" aria-label="' + pageNo + '">' + pageNo + '</a></li>'
|
||||
);
|
||||
var pageGroupNo = this.getPageGroupNo(this.activePageNo);
|
||||
var startNo = pageGroupNo * 10 + 1;
|
||||
var endNo = (pageGroupNo + 1) * 10 > this.lastPageNo ? this.lastPageNo : (pageGroupNo + 1) * 10;
|
||||
for(var pageNo = startNo; pageNo < endNo + 1; pageNo++) {
|
||||
var pageContent = "";
|
||||
if(pageNo == this.activePageNo) {
|
||||
pageContent = '<li class="page-item disabled"><a class="page-link" href="javascript:void(0);" aria-label="'
|
||||
+ pageNo + '">' + pageNo + '</a></li>';
|
||||
} else {
|
||||
pageContent = '<li class="page-item"><a class="page-link" href="javascript:void(0);" aria-label="'
|
||||
+ pageNo + '">' + pageNo + '</a></li>';
|
||||
}
|
||||
$(this.pagination).append(pageContent);
|
||||
}
|
||||
|
||||
// right arrows
|
||||
@@ -68,6 +76,18 @@ PlayerListNavigator.prototype.makePagination = function() {
|
||||
$(this.pagination).append(paginationRightArrows);
|
||||
}
|
||||
|
||||
PlayerListNavigator.prototype.getPageGroupNo = function(index) {
|
||||
var pageGroupNo = Math.floor( (index - 1) / 10 );
|
||||
var lastPageGroupNo = Math.floor( (this.lastPageNo - 1) / 10 );
|
||||
|
||||
if(pageGroupNo < 0)
|
||||
return 0;
|
||||
else if(pageGroupNo > lastPageGroupNo)
|
||||
return lastPageGroupNo;
|
||||
else
|
||||
return pageGroupNo;
|
||||
}
|
||||
|
||||
PlayerListNavigator.prototype.applyClickEvent = function() {
|
||||
var self = this;
|
||||
|
||||
@@ -81,7 +101,8 @@ PlayerListNavigator.prototype.applyClickEvent = function() {
|
||||
|
||||
for(var pageNo = 1; pageNo < this.lastPageNo + 1; pageNo++) {
|
||||
$("[aria-label='" + pageNo + "']").click(function() {
|
||||
self.onClickPageNo(pageNo);
|
||||
var selectedPageNo = $(this).attr("aria-label");
|
||||
self.onClickPageNo(selectedPageNo);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -130,20 +151,18 @@ PlayerListNavigator.prototype.disableNavButtons = function() {
|
||||
}
|
||||
|
||||
PlayerListNavigator.prototype.onClickPageNo = function(pageNo) {
|
||||
console.log(pageNo);
|
||||
// console.log(pageNo);
|
||||
switch(pageNo) {
|
||||
case "first":
|
||||
this.activePageNo = 1;
|
||||
break;
|
||||
|
||||
case "previous":
|
||||
if(this.activePageNo > 1)
|
||||
this.activePageNo -= 1;
|
||||
this.activePageNo = this.getPrevGroupPage();
|
||||
break;
|
||||
|
||||
case "next":
|
||||
if(this.activePageNo < this.lastPageNo)
|
||||
this.activePageNo += 1;
|
||||
this.activePageNo = this.getNextGroupPage();
|
||||
break;
|
||||
|
||||
case "last":
|
||||
@@ -154,6 +173,34 @@ PlayerListNavigator.prototype.onClickPageNo = function(pageNo) {
|
||||
this.activePageNo = pageNo;
|
||||
}
|
||||
|
||||
console.log(this.activePageNo);
|
||||
// console.log(this.activePageNo);
|
||||
this.playerListManager.onClickPageNo(this.activePageNo);
|
||||
}
|
||||
|
||||
PlayerListNavigator.prototype.getPrevGroupPage = function() {
|
||||
var savedPageNo = this.activePageNo;
|
||||
var savedPageGroupNo = this.getPageGroupNo(savedPageNo);
|
||||
|
||||
var pageNo = this.activePageNo - 10;
|
||||
var pageGroupNo = this.getPageGroupNo(pageNo);
|
||||
|
||||
if(pageGroupNo < savedPageGroupNo) {
|
||||
var prevGroupLastPageNo = (pageGroupNo + 1) * 10;
|
||||
return prevGroupLastPageNo;
|
||||
}
|
||||
return pageGroupNo * 10 + 1;
|
||||
}
|
||||
|
||||
PlayerListNavigator.prototype.getNextGroupPage = function() {
|
||||
var savedPageNo = this.activePageNo;
|
||||
var savedPageGroupNo = this.getPageGroupNo(savedPageNo);
|
||||
|
||||
var pageNo = this.activePageNo + 10;
|
||||
var pageGroupNo = this.getPageGroupNo(pageNo);
|
||||
|
||||
if(pageGroupNo > savedPageGroupNo) {
|
||||
var prevGroupLastPageNo = pageGroupNo * 10 + 1;
|
||||
return prevGroupLastPageNo;
|
||||
}
|
||||
return this.lastPageNo;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ function onErrorPlayerPW(message) {
|
||||
<label for="entercode" class="col-sm-3 col-form-label">입장 번호</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control col-sm-9" id="entercode" placeholder="입장 번호 입력">
|
||||
<small class="form-text text-muted">4~6자리의 숫자</small>
|
||||
<small class="form-text text-muted">2~6자리의 숫자</small>
|
||||
<button type="button" class="col-sm-7 btn btn-primary btn-lg mt-3" onClick="addPlayer()">추가</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,17 @@ $maestroName = $_POST["maestro_name"];
|
||||
$name = $_POST["name"];
|
||||
$enterCode = $_POST["enter_code"];
|
||||
|
||||
if($enterCode === "" || strlen($enterCode) < 2) {
|
||||
set_error_message("입장번호는 2개 이상의 숫자로 입력해야 합니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
if(strlen($enterCode) > 6) {
|
||||
set_error_message("입장번호는 6개 이gk의 숫자로 입력해야 합니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$maestroInfo = get_maestro_id($maestroName);
|
||||
if($maestroInfo === NULL) {
|
||||
@@ -21,7 +32,7 @@ $maestroAccountType = $maestroInfo["accountType"];
|
||||
|
||||
$playerInfo = get_login_data($maestroID, $name, $enterCode);
|
||||
if($playerInfo === NULL) {
|
||||
set_error_message("입력한 이름/입장번호와 일치하는 계정이 없습니다");
|
||||
set_error_message("입력한 이름 / 입장번호와 일치하는 계정이 없습니다");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user