issue 368 add function that modify emadil address

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9937 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2011-12-09 10:02:16 +00:00
parent cb41b97873
commit 7285649ed2
11 changed files with 178 additions and 4 deletions

View file

@ -6,6 +6,7 @@
<actions>
<action name="dispMemberInfo" type="view" standalone="true" />
<action name="dispMemberSignUpForm" type="view" standalone="true" />
<action name="dispMemberModifyEmailAddress" type="view" />
<action name="dispMemberModifyInfo" type="view" standalone="true" />
<action name="dispMemberModifyPassword" type="view" standalone="true" />
<action name="dispMemberLoginForm" type="view" standalone="true" />
@ -46,6 +47,7 @@
<action name="procMemberLogout" type="controller" standalone="true" />
<action name="procMemberCheckValue" type="controller" standalone="true" />
<action name="procMemberInsert" type="controller" standalone="true" ruleset="@insertMember" />
<action name="procMemberModifyEmailAddress" type="controller" ruleset="modifyEmailAddress" />
<action name="procMemberModifyInfo" type="controller" standalone="true" ruleset="@insertMember" />
<action name="procMemberModifyPassword" type="controller" standalone="true" ruleset="modifyPassword" />
<action name="procMemberLeave" type="controller" standalone="true" ruleset="leaveMember" />
@ -67,6 +69,7 @@
<action name="procMemberFindAccount" type="controller" standalone="true" />
<action name="procMemberFindAccountByQuestion" type="controller" standalone="true" />
<action name="procMemberAuthAccount" type="controller" standalone="true" />
<action name="procMemberAuthEmailAddress" type="controller" />
<action name="procMemberUpdateAuthMail" type="controller" standalone="true" />
<action name="procMemberResendAuthMail" type="controller" standalone="true" ruleset="resendAuthMail" />

View file

@ -863,6 +863,14 @@
<value xml:lang="tr"><![CDATA[Kaydol]]></value>
<value xml:lang="vi"><![CDATA[Đăng kí]]></value>
</item>
<item name="cmd_modify_member_email_address">
<value xml:lang="ko"><![CDATA[이메일 주소 변경]]></value>
<value xml:lang="en"><![CDATA[Change Email Address]]></value>
</item>
<item name="about_modify_member_email_address">
<value xml:lang="ko"><![CDATA[사용하시는 이메일 주소를 변경할 수 있습니다.]]></value>
<value xml:lang="en"><![CDATA[You could change EmailAddress.]]></value>
</item>
<item name="cmd_modify_member_info">
<value xml:lang="ko"><![CDATA[회원정보 변경]]></value>
<value xml:lang="en"><![CDATA[Change Member Info]]></value>
@ -925,6 +933,9 @@
<value xml:lang="tr"><![CDATA[Etkinleştirme Maili Talebinde Bulun]]></value>
<value xml:lang="vi"><![CDATA[Xác nhận lại Email]]></value>
</item>
<item name="cmd_send_auth_new_emaill_address">
<value xml:lang="ko"><![CDATA[신규 이메일 인증 메일 발송]]></value>
</item>
<item name="cmd_member_list">
<value xml:lang="ko"><![CDATA[회원 목록]]></value>
<value xml:lang="en"><![CDATA[Member List]]></value>
@ -1170,6 +1181,9 @@
<value xml:lang="tr"><![CDATA[XE Hesap Etkinleştirmesi]]></value>
<value xml:lang="vi"><![CDATA[Thông tin đăng kí thành viên tại Website http://4all.kr]]></value>
</item>
<item name="title_modify_email_address">
<value xml:lang="ko"><![CDATA[이메일주소 변경 요청 확인 메일입니다.]]></value>
</item>
<item name="msg_confirm_account_info">
<value xml:lang="ko"><![CDATA[가입하신 계정 정보는 아래와 같습니다.]]></value>
<value xml:lang="en"><![CDATA[This is your account information:]]></value>
@ -1193,6 +1207,9 @@
<value xml:lang="tr"><![CDATA[Hesabınızı etkinleştirmek için takip eden linke tıklayınız.]]></value>
<value xml:lang="vi"><![CDATA[Bấm vào đường Link này để hoàn tất việc đăng kí.]]></value>
</item>
<item name="msg_confirm_email_address_change">
<value xml:lang="ko"><![CDATA[아래 링크를 클릭하시면 이메일 주소가 변경됩니다.]]></value>
</item>
<item name="msg_auth_mail_sent">
<value xml:lang="ko"><![CDATA[%s 메일로 인증 정보를 담은 메일이 발송되었습니다. 메일을 확인하세요.]]></value>
<value xml:lang="en"><![CDATA[The activation mail has been sent to %s. Please check your mail.]]></value>
@ -1216,6 +1233,9 @@
<value xml:lang="tr"><![CDATA[%s adresine etkinleştirme maili gönderdik. Lütfen mailinizi kontrol ediniz.]]></value>
<value xml:lang="vi"><![CDATA[Chúng tôi đã gửi Email xác nhận đến %s. Xin vui lòng bấm vào Link đi kèm trong Email để hoàn tất việc đăng kí!]]></value>
</item>
<item name="msg_invalid_modify_email_auth_key">
<value xml:lang="ko"><![CDATA[잘못된 이메일 변경 요청입니다.<br />이메일 변경요청을 다시 하시거나 사이트 관리자에게 문의해주세요.]]></value>
</item>
<item name="msg_invalid_auth_key">
<value xml:lang="ko"><![CDATA[잘못된 계정 인증 요청입니다.<br />아이디/비밀번호 찾기를 다시 하시거나 사이트 관리자에게 계정 정보를 문의해주세요.]]></value>
<value xml:lang="en"><![CDATA[This is an invalid request of verification.<br />Please retry finding account info or contact the administrator.]]></value>
@ -2395,4 +2415,7 @@ Bạn có thể quản lý thành viên bằng cách tạo những nhóm mới,
<value xml:lang="ko"><![CDATA[회원 설정]]></value>
<value xml:lang="en"><![CDATA[Member Configuration]]></value>
</item>
<item name="msg_success_modify_email_address">
<value xml:lang="ko"><![CDATA[이메일 주소가 정상적으로 변경되었습니다. 변경된 이메일 주소로 로그인 가능합니다.]]></value>
</item>
</lang>

View file

@ -2017,5 +2017,84 @@
}
}
}
function procMemberModifyEmailAddress(){
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$member_info = Context::get('logged_info');
$newEmail = Context::get('email_address');
if(!$newEmail) return $this->stop('msg_invalid_request');
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail);
if($member_srl) return new Object(-1,'msg_exists_email_address');
$auth_args->user_id = $newEmail;
$auth_args->member_srl = $member_info->member_srl;
$auth_args->auth_key = md5(rand(0, 999999));
$auth_args->new_password = 'XE_change_emaill_address';
$output = executeQuery('member.insertAuthMail', $auth_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
$tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin);
if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
$memberInfo["$lang->email_address"] = $member_info->email_address;
$auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key);
Context::set('auth_url', $auth_url);
$oTemplate = &TemplateHandler::getInstance();
$content = $oTemplate->compile($tpl_path, 'confirm_member_new_email');
$oMail = new Mail();
$oMail->setTitle( Context::getLang('title_modify_email_address') );
$oMail->setContent($content);
$oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email);
$oMail->setReceiptor( $member_info->nick_name, $newEmail );
$result = $oMail->send();
$msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail);
$this->setMessage($msg);
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '');
header('location:'.$returnUrl);
return;
}
}
function procMemberAuthEmailAddress(){
$member_srl = Context::get('member_srl');
$auth_key = Context::get('auth_key');
if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request');
// Test logs for finding password by user_id and authkey
$args->member_srl = $member_srl;
$args->auth_key = $auth_key;
$output = executeQuery('member.getAuthMail', $args);
if(!$output->toBool() || $output->data->auth_key != $auth_key) return $this->stop('msg_invalid_modify_email_auth_key');
$newEmail = $output->data->user_id;
$args->email_address = $newEmail;
list($args->email_id, $args->email_host) = explode('@', $newEmail);
$output = executeQuery('member.updateMemberEmailAddress', $args);
if(!$output->toBool()) return $this->stop($output->getMessage());
// Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table
executeQuery('member.deleteAuthChangeEmailAddress',$args);
// Notify the result
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('msg_success_modify_email_address');
}
}
?>

View file

@ -366,5 +366,14 @@
$this->setTemplateFile('resend_auth_mail');
}
/**
* @brief 이메일 주소를 기본 로그인 계정 사용시 이메일 주소 변경을 위한 화면 추가
**/
function dispMemberModifyEmailAddress(){
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$this->setTemplateFile('modify_email_address');
}
}
?>

View file

@ -0,0 +1,9 @@
<query id="deleteAuthChangeEmailAddress" action="delete">
<tables>
<table name="member_auth_mail" />
</tables>
<conditions>
<condition operation="equal" column="member_srl" var="member_srl" notnull="notnull" />
<condition operation="equal" column="new_password" default="XE_change_emaill_address" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,13 @@
<query id="updateMemberEmailAddress" action="update">
<tables>
<table name="member" />
</tables>
<columns>
<column name="email_address" var="email_address" notnull="notnull" />
<column name="email_id" var="email_id" notnull="notnull" />
<column name="email_host" var="email_host" notnull="notnull" />
</columns>
<conditions>
<condition operation="equal" column="member_srl" var="member_srl" notnull="notnull" filter="number" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="email_address" required="true" rule="email" />
</fields>
</ruleset>

View file

@ -0,0 +1,9 @@
{$lang->msg_confirm_account_info}<br />
<hr noshade="noshade" />
<ul>
<li>Site : <a href="{getUrl()}" target="_blank">{getUrl()}</a></li>
<li loop="$memberInfo=>$name,$value">{$name} : {$value}</li>
</ul>
<hr noshade="noshade" />
{$lang->msg_confirm_email_address_change}<br />
<a href="{$auth_url}">{$auth_url}</a>

View file

@ -60,12 +60,9 @@
</table>
</div>
<div class="btnArea" cond="$memberInfo['member_srl'] == $logged_info->member_srl">
<span class="btn" cond="$member_config->identifier == 'email_address'"><a href="{getUrl('act', 'dispMemberModifyEmailAddress')}">{$lang->cmd_modify_member_email_address}</a></span>
<span class="btn"><a href="{getUrl('act','dispMemberModifyInfo','member_srl','')}">{$lang->cmd_modify_member_info}</a></span>
<!--@if($logged_info->is_openid)-->
<span class="btn"><a href="{getUrl('act','dispMemberOpenIDLeave','member_srl','')}">{$lang->cmd_leave}</a></span>
<!--@else-->
<span class="btn"><a href="{getUrl('act','dispMemberModifyPassword','member_srl','')}">{$lang->cmd_modify_member_password}</a></span>
<span class="btn"><a href="{getUrl('act','dispMemberLeave','member_srl','')}">{$lang->cmd_leave}</a></span>
<!--@end-->
</div>
<include target="./common_footer.html" />

View file

@ -0,0 +1,20 @@
<include target="./common_header.html" />
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="modifyEmailAddress" class="form" action="./" method="post">
<input type="hidden" name="module" value="member" />
<input type="hidden" name="act" value="procMemberModifyEmailAddress" />
<h1 class="h1">{$lang->cmd_modify_member_email_address}</h1>
<p>{$lang->about_modify_member_email_address}</p>
<ul>
<li>
<p class="q"><label for="email_address">{$lang->email_address}</label></p>
<p class="a"><input type="text" id="email_address" name="email_address" value="" /></p>
</li>
</ul>
<div class="btnArea">
<span class="btn"><input type="submit" value="{$lang->cmd_send_auth_new_emaill_address}" /></span>
</div>
</form>
<include target="./common_footer.html" />

View file

@ -0,0 +1,4 @@
<script type="text/javascript">
alert("{$lang->msg_success_modify_email_address}");
location.href="{getUrl()}";
</script>