탈퇴 프로세스 추가

This commit is contained in:
2018-03-21 02:57:59 +09:00
parent f3d7a6a1a7
commit f7a9445954
12 changed files with 167 additions and 221 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ CREATE TABLE `member_log` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`member_no` INT(11) NOT NULL,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`action_type` ENUM('reg','try_login','login','logout','oauth','change_pw','make_general','access_server') NOT NULL,
`action_type` ENUM('reg','try_login','login','logout','oauth','change_pw','make_general','access_server','delete') NOT NULL,
`action` TEXT NULL DEFAULT NULL COMMENT 'JSON',
PRIMARY KEY (`id`),
INDEX `action` (`member_no`, `action_type`, `date`),
+1 -2
View File
@@ -43,7 +43,6 @@ var serverLoginTemplate = "\
";
function Entrance_Import() {
ImportAction("../i_entrance/manage/Action.js");
}
function Entrance_Init() {
@@ -108,7 +107,7 @@ function Entrance_drawServerList(serverInfos){
TemplateEngine(serverTextInfo, game)
);
if(result.me){
if(result.me && result.me.length > 1){
var me = result.me;
me.serverPath = serverPath;
$serverHtml.append(
+73
View File
@@ -0,0 +1,73 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_func/class._Time.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_func/class._Session.php');
$SESSION = new _Session();
if(!$SESSION->isLoggedIn()) {
returnJson([
'result'=>false,
'reason'=>'로그인되지 않았습니다.'
]);
}
// 외부 파라미터
// $_POST['pw'] : PW
$pw = $_POST['pw'];
if(!$pw){
returnJson([
'result'=>false,
'reason'=>'패스워드를 입력해주세요.'
]);
}
//TODO: 탈퇴 처리하되 한달간 유지.
$db = getRootDB();
$userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM MEMBER '.
'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)',
$SESSION->NoMember(), $pw);
if(!$userInfo){
returnJson([
'result'=>false,
'reason'=>'현재 비밀번호가 일치하지 않습니다.'
]);
}
if($userInfo['delete_after']){
returnJson([
'result'=>false,
'reason'=>'이미 탈퇴 처리되어있습니다.'
]);
}
$db->update('member',[
'delete_after'=>_Time::DatetimeFromNowMinute(60*24*30)
], 'no=%i', $SESSION->NoMember());
if(!$db->affectedRows()){
returnJson([
'result'=>false,
'reason'=>'알 수 없는 이유로 탈퇴에 실패했습니다.'
]);
}
$db->insert('member_log', [
'member_no'=>$SESSION->NoMember(),
'action_type'=>'delete'
]);
$SESSION->logout();
unset($_SESSION['access_token']);
setcookie("hello", "", time()-3600);
returnJson([
'result'=>true,
'reason'=>'success'
]);
-8
View File
@@ -43,14 +43,6 @@ if($dt == $rf) {
'IMGSVR'=>0,
], 'NO=%i', $SESSION->NoMember());
//TODO: 각 세부 서버가 '열린 경우' 이미지를 갱신하도록 처리
//Token을 받아 처리하는 형식이면 가능할듯.
/*
for($i=0; $i < ; $i++) {
Update('general', "PICTURE='default.jpg', IMGSVR=0", "NPC=0 AND USER_ID='{$member['ID']}'");
}
*/
$servers = [];
foreach(getServerConfigList() as $key=>$server){
View File
-54
View File
@@ -1,54 +0,0 @@
<?php
require_once('_common.php');
?>
<div id="EntranceManage_00" class="bg0">
<div id="EntranceManage_0000" class="bg2 font4">계 정 관 리</div>
<input id="EntranceManage_0001" type="button" value="돌아가기">
<div id="EntranceManage_0002" class="bg1 font3">회 원 정 보</div>
<div id="EntranceManage_0003" class="bg1 font2">ID</div>
<div id="EntranceManage_0004"></div>
<input id="EntranceManage_0019" type="button" value="탈퇴신청">
<div id="EntranceManage_0005" class="bg1 font2">비밀번호</div>
<div id="EntranceManage_0006">
현재비번: <input id="EntranceManage_000600" type="password" maxlength="12">
바꿀비번: <input id="EntranceManage_000601" type="password" maxlength="12">
다시입력: <input id="EntranceManage_000602" type="password" maxlength="12">
<input id="EntranceManage_000603" type="button" value="비밀번호 변경">
</div>
<div id="EntranceManage_0007" class="bg1 font2">닉네임</div>
<div id="EntranceManage_0008"></div>
<div id="EntranceManage_0009" class="bg1 font2">등급</div>
<div id="EntranceManage_0010"></div>
<div id="EntranceManage_0011" class="bg1 font2">-</div>
<div id="EntranceManage_0012" class="bg1 font2">기존 / 신규</div>
<div id="EntranceManage_0013" class="bg1 font2">전용아이콘 올리기</div>
<div id="EntranceManage_0014" class="bg1 font2">전용사진</div>
<div id="EntranceManage_0015">
<img id="EntranceManage_001500">
<img id="EntranceManage_001501">
</div>
<div id="EntranceManage_0016">
<input id="EntranceManage_001600" type="text">
<form id="formIcon" action="<?=ROOT?>/i_entrance/manage/iconPost.php" method="POST" enctype="multipart/form-data">
<input id="EntranceManage_001601" name="picture" type="file" size="15">
</form>
<input id="EntranceManage_001602" type="button" value="전콘변경">
<input id="EntranceManage_001603" type="button" value="전콘제거">
</div>
<div id="EntranceManage_0017" class="bg1 font2">도움말</div>
<div id="EntranceManage_0018">
<pre>jpg,png,gif 파일 64 x 64 크기만 가능합니다.
서버최적화를 위해 신규에서 기존으로 약 월1회 저장됩니다.
<font color=cyan>브라우저의 임시파일을 삭제하셔야 제대로 나옵니다.
새로 캐릭터를 생성할때부터 적용됩니다.</font>
<font color=magenta>탈퇴신청시 1개월간 정보가 보존되며,
1개월간 재가입이 불가능합니다.</font></pre>
</div>
</div>
-10
View File
@@ -1,10 +0,0 @@
<?php
if(!defined('ROOT')){
define('ROOT', '../..');
}
require_once(ROOT.'/f_config/config.php');
require_once(ROOT.'/f_config/app.php');
require_once(ROOT.'/f_func/func.php');
CustomHeader();
-34
View File
@@ -1,34 +0,0 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_func/class._Time.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
// 외부 파라미터
// $_POST['pw'] : PW
$pw = $_POST['pw'];
$response['result'] = 'FAIL';
//TODO: 즉시 탈퇴 처리하되,
$db = getRootDB();
$member = $db->queryFirstRow('SELECT `PW` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
if($member['PW'] != $pw) {
$response['result'] = 'FAIL';
$response['msg'] = '실패: 현재 비밀번호가 일치하지 않습니다.';
} else {
$db->update('MEMBER', array(
'QUIT' => 'Y',
'REG_DATE'=> _Time::DatetimeNow()
), 'NO=%i', $SESSION->NoMember());
$SESSION->logout();
$response['result'] = 'SUCCESS';
$response['msg'] = "정상적으로 탈퇴신청 되었습니다.";
}
echo json_encode($response);
+1 -1
View File
@@ -39,7 +39,7 @@
position:absolute;
height:16px;
left:10px;
width:150px;
width:130px;
top:16px;
}
+41 -25
View File
@@ -30,38 +30,24 @@
</caption>
<colgroup>
<col style="width:80px;" />
<col style="width:140px;"/>
<col style="width:80px;"/>
<col style="width:80px;"/>
<col style="width:80px;"/>
<col style="width:80px;"/>
<col/>
</colgroup>
<thead>
<tr>
<th colspan="4" class="bg1">회 원 정 보</th>
<th colspan="6" class="bg1">회 원 정 보</th>
</tr>
</thead>
<tbody>
<tr>
<th class="bg1">ID</th>
<td style="position:relative;">
<td>
<span id="slot_id"></span>
<button id="btn_delete_me">탈퇴신청</button>
</td>
<th class="bg1">비밀번호</th>
<td style="text-align:right;">
<form name="change_pw_form" id="change_pw_form" method="post">
<input type="hidden" id="global_salt" name="global_salt">
<input type="text" autocomplete="username" style="display:none;"><!--자동 완성툴을 위해-->
<label for="current_pw">현재 비밀번호</label>
<input class="with_skin" type="password" autocomplete="current-password" name="current_pw" id="current_pw" style="width:100px;"><br>
<label for="new_pw">새 비밀번호</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw" id="new_pw" style="width:100px;"><br>
<label for="new_pw_confirm">비밀번호 확인</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw_confirm" id="new_pw_confirm" style="width:100px;"><br>
<input class="with_skin" type="submit" id="change_pw" value="비밀번호 변경">
</form>
</td>
</tr>
<tr>
<th class="bg1">닉네임</th>
<td style="height:36px;">
<span id="slot_nickname"></span>
@@ -70,23 +56,53 @@
<td>
<span id="slot_grade"></span>
</td>
</tr>
<tr>
<th class="bg1"></th>
<th class="bg1">
<th class="bg1" colspan="2">회원 탈퇴</th>
<th class="bg1" colspan="3">비밀번호 변경</th>
</tr>
<tr>
<th class="bg1">정보<br>수정</th>
<td colspan="2" style="position:relative;">
<form name="delete_me_form" id="delete_me_form" method="post">
<label for="delete_pw">현재 비밀번호</label>
<input class="with_skin" type="password" autocomplete="current-password" name="delete_pw" id="delete_pw" style="width:120px;"><br>
<br>
<input class="with_skin" type="submit" id="btn_delete_me" value="탈퇴신청">
</form>
</td>
<td colspan="3" style="text-align:right;">
<form name="change_pw_form" id="change_pw_form" method="post">
<input type="hidden" id="global_salt" name="global_salt">
<input type="text" autocomplete="username" style="display:none;"><!--자동 완성툴을 위해-->
<label for="current_pw">현재 비밀번호</label>
<input class="with_skin" type="password" autocomplete="current-password" name="current_pw" id="current_pw" style="width:120px;"><br>
<label for="new_pw">새 비밀번호</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw" id="new_pw" style="width:120px;"><br>
<label for="new_pw_confirm">비밀번호 확인</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw_confirm" id="new_pw_confirm" style="width:120px;"><br>
<input class="with_skin" type="submit" id="change_pw" value="비밀번호 변경">
</form>
</td>
</tr>
<tr>
<th class="bg1"></th>
<th colspan="2" class="bg1">
현재 / 신규
</th>
<th colspan="2" class="bg1">
<th colspan="3" class="bg1">
전용 아이콘 변경
</th>
</tr>
<tr>
<th class="bg1">전용<br>아이콘</th>
<td style="height:64px;">
<td colspan="2" style="height:64px;">
<img width="64px" height="64px" id="slot_icon" src="../../image/default.jpg">
<img width="64px" height="64px" id="slot_new_icon" src="../../image/default.jpg">
</td>
<td colspan="2" style="position:relative;" >
<td colspan="3" style="position:relative;" >
<form name="change_icon_form" id="change_icon_form" method="post" enctype="multipart/form-data">
<input class="with_skin" type="text" readonly="readonly" id="image_upload_filename">
<button id="image_upload_fake_btn" class="with_skin">찾아보기</button>
@@ -101,7 +117,7 @@
<tfoot>
<tr>
<th class="bg1">도움말</th>
<td colspan="3" style="text-align:left;padding:8px;">
<td colspan="5" style="text-align:left;padding:8px;">
<p style="line-height:1.2em;">
아이콘은 64 x 64픽셀, 10KB 이하의 jpg, gif, png 파일만 가능합니다.</p>
<p style="margin-top:1em;color:magenta;line-height:1.2em;">탈퇴시 1개월간 정보가 보존되며, 1개월간 재가입이 불가능합니다.</span>
+49 -85
View File
@@ -68,9 +68,16 @@ function deleteIcon(){
function changeIcon(e){
e.preventDefault();
console.log('haha');
var $icon = $('#image_upload');
if($icon[0].files.length == 0){
alert('파일을 선택해주세요');
return false;
}
var icon = $icon[0].files[0];
$.ajax({
type:'post',
url:'j_icon_change.php',
@@ -156,6 +163,40 @@ function changePassword(e){
});
}
function deleteMe(){
var $form = $('#delete_me_form');
var pw = $('#delete_pw').val();
if(!pw){
alert('비밀번호를 입력해야 합니다.');
return;
}
var global_salt = $('#global_salt').val();
var password = sha512(global_salt+pw+global_salt);
$.ajax({
type:'post',
url:'j_delete_me.php',
dataType:'json',
data:{
pw:password
}
}).then(function(result){
if(!result.result){
alert(result.reason);
}
else{
alert('탈퇴 처리되었습니다.');
location.href='../';
}
},function(){
alert('알 수 없는 이유로 회원탈퇴에 실패했습니다.');
});
}
$(function(){
$.ajax({
type:'post',
@@ -180,29 +221,16 @@ $(function(){
$('#change_pw_form').submit(changePassword);
$('#change_icon_form').submit(changeIcon);
$('#delete_me_form').submit(function(e){
e.preventDefault();
if(confirm('한 달 동안 재 가입할 수 없습니다. 정말로 탈퇴할까요?')){
deleteMe(e);
}
});
})
function EntranceManage_Import() {
}
function EntranceManage_Init() {
$("#EntranceManage_0001").click(EntranceManage_Back);
$("#EntranceManage_000603").click(EntranceManage_ChangePw);
$("#EntranceManage_001600").attr("disabled", "true");
$("#EntranceManage_001601").change(EntranceManage_SelectIcon);
$("#EntranceManage_001602").click(EntranceManage_ChangeIcon);
$("#EntranceManage_001603").click(EntranceManage_DeleteIcon);
$("#EntranceManage_0019").click(EntranceManage_Quit);
if(navigator.userAgent.match('mozilla')) {
$("#EntranceManage_001601").css("left", "10px");
} else {
$("#EntranceManage_001600").show();
}
}
function EntranceManage_Update() {
Popup_Wait(function() {
PostJSON(
@@ -220,70 +248,6 @@ function EntranceManage_Update() {
});
}
function EntranceManage_Back() {
$("#EntranceManage_00").hide();
$("#Entrance_00").show();
Entrance_Update();
}
function EntranceManage_SelectIcon() {
$("#EntranceManage_001600").val($("#EntranceManage_001601").val());
}
function EntranceManage_UpdateInfo(member) {
$("#EntranceManage_0004").text(member.id);
$("#EntranceManage_0008").text(member.name);
$("#EntranceManage_0010").text(member.grade);
$("#EntranceManage_001500").attr("src", member.picture0);
$("#EntranceManage_001501").attr("src", member.picture1);
}
function EntranceManage_ChangePw() {
var pw = $("#EntranceManage_000600").val();
var pw1 = $("#EntranceManage_000601").val();
var pw2 = $("#EntranceManage_000602").val();
if(pw.length < 4 || pw.length > 12) {
Popup_Alert("비밀번호 길이가 부적합합니다!", function() {
$("#EntranceManage_000600").val("");
$("#EntranceManage_000600").focus();
});
return false;
}
if(pw1.length < 4 || pw1.length > 12) {
Popup_Alert("비밀번호 길이가 부적합합니다!", function() {
$("#EntranceManage_000601").val("");
$("#EntranceManage_000601").focus();
});
return false;
}
if(pw1 != pw2) {
Popup_Alert("비밀번호가 일치하지 않습니다!", function() {
$("#EntranceManage_000601").val("");
$("#EntranceManage_000601").focus();
});
return false;
}
Popup_Confirm('정말 실행하시겠습니까?', function() {
Popup_Wait(function() {
PostJSON(
"../../i_entrance/manage/passwordPost.php", {
pw: hex_md5(pw+""+pw),
newPw: hex_md5(pw1+""+pw1)
},
function(response, textStatus) {
Popup_WaitShow(response.msg, function() {
$("#EntranceManage_000600").val("");
$("#EntranceManage_000601").val("");
$("#EntranceManage_000602").val("");
});
}
)
})
});
}
function EntranceManage_ChangeIcon() {
if($("#EntranceManage_001601").val() == "") {
Popup_Alert("파일을 선택해 주세요!");
+1 -1
View File
@@ -90,5 +90,5 @@ if($generalID){
//TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것.
returnJson([
'game'=>$game,
'me'=>$me
'me'=>$me?$me:null
]);