Authored by whb

找回密码

... ... @@ -30,7 +30,7 @@
</span>
</li>
<li class="input-container-li clearfix">
<input type="hidden" name="code" value="159bI6arxsuaPBxG2iV9OE9BrgDnAPiTecUqYh2iUC3ntt6S0eOtxXpVu+jWIlveXx9NRuwS9zdrXzcUyOd+d3ikzYBAo0k">
<input type="hidden" name="code" value="{{code}}">
<input id="reset-pwd-btn" class="btn reset-pwd-btn" type="submit" value="提交" disabled="">
</li>
</ul>
... ...
{{> layout/simple-header}}
<div class="verification-page back-page passport-page yoho-page clearfix">
{{# verification}}
{{> passport/cover}}
<div class="content">
<form id="verification-form" class="verification-form" method="POST" action="/passport/back/backmobile">
<ul>
<li class="head-title">验证身份</li>
<li class="po-re">
<label class="pn-label">手机号码</label>
<span class="country-code">+{{area}}</span>
<span class="phone-num">{{phoneNum}}</span>
</li>
<li class="po-re">
<input id="captcha" class="input va captcha" type="text" name="captcha">
<input id="send-captcha" class="btn send-captcha" type="button" value="发送验证码" disabled="">
<div id="captcha-tip" class="captcha-tips"><i class="iconfont">&#xe61f;</i>验证码已发送至您的手机,请查收</div>
<span id="err-tip" class="err-tip hide">
<i></i>
<em>请输入验证码</em>
</span>
</li>
<li>
<input name="area" id="area" type="hidden" value="{{area}}">
<input name="mobile" id="mobile" type="hidden" value="{{phoneNum}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="g7ce">
<input name="refer" id="refer" type="hidden" value="">
<input id="next-step" class="btn next-step disable" type="submit" value="下一步" disabled="">
</li>
</ul>
</form>
</div>
{{/ verification}}
</div>
{{> layout/simple-header}}
<div class="verification-page back-page passport-page yoho-page clearfix">
{{# verification}}
{{> passport/cover}}
<div class="content">
<form id="verification-form" class="verification-form" method="POST" action="/passport/back/backmobile">
<ul>
<li class="head-title">验证身份</li>
<li class="po-re">
<label class="pn-label">手机号码</label>
<span class="country-code">+{{area}}</span>
<span class="phone-num">{{phoneNum}}</span>
</li>
<li class="po-re">
<input id="captcha" class="input va captcha" type="text" name="captcha">
<input id="send-captcha" class="btn send-captcha" type="button" value="发送验证码" disabled="">
<div id="captcha-tip" class="captcha-tips"><i class="iconfont">&#xe61f;</i>验证码已发送至您的手机,请查收</div>
<span id="err-tip" class="err-tip hide">
<i></i>
<em>请输入验证码</em>
</span>
</li>
<li>
<input name="area" id="area" type="hidden" value="{{area}}">
<input name="mobile" id="mobile" type="hidden" value="{{phoneNum}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="{{captcha}}">
<input name="refer" id="refer" type="hidden" value="">
<input id="next-step" class="btn next-step disable" type="submit" value="下一步" disabled="">
</li>
</ul>
</form>
</div>
{{/ verification}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
<li class="clearfix">
<select id="region" class="region" name="region">
{{#each region}}
<option {{#if selected}}selected="selected"{{/if}} value="{{id}}">{{name}}</option>
<option {{#if selected}}selected="selected"{{/if}} value="{{areaCode}}">{{name}}</option>
{{/each}}
</select>
</li>
... ...
... ... @@ -73,7 +73,7 @@ class Bootstrap extends Bootstrap_Abstract
$action = 'Index';
// 二级域名
if (3 === $level) {
if (2 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
... ... @@ -90,6 +90,10 @@ class Bootstrap extends Bootstrap_Abstract
case 'list': // 商品列表
$module = 'Product';
break;
case 'sale'://促销
$module = 'Product';
$controller = 'sale';
default: // 其它(识别为品牌)
$module = 'Product';
$action = 'Brand';
... ...
... ... @@ -56,6 +56,7 @@ class BackController extends WebAction
$data = BackData::sendCodeToMobile($mobile);
$this->setSession('phoneNum', $phoneNum);
$this->setSession('area', $area);
$this->setSession('captcha', $captcha);
if($data['code'] == 200) {
$this->redirect('verification');
}
... ... @@ -66,7 +67,7 @@ class BackController extends WebAction
}
/**
* 发送邮件
* 发送邮件页面
*/
public function sendemailAction() {
$phoneNum = $this->getSession('phoneNum');
... ... @@ -96,14 +97,14 @@ class BackController extends WebAction
'sendEmail' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array()
'countrys' => array(),
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
... ... @@ -118,14 +119,15 @@ class BackController extends WebAction
'resetPwd' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array()
'countrys' => array(),
'code' => $code,
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码
* 更新密码接口
*
*/
public function updateAction()
... ... @@ -134,10 +136,22 @@ class BackController extends WebAction
$password = $this->post('pwd');
$info = $this->checkCode($code);
if(Helpers::verifyPassword($password) && !empty($info)) {
$uid = $info['uid'];
//修改密码
if(isset($info['mobile'])) {//手机号修改密码
$mobile = $info['mobile'];
$token = $info['token'];
$area = $info['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if($data['code']) {
$this->redirect('resetSuccess');
}
} else if(isset($info['uid'])) {//其他方式修改密码
$uid = $info['uid'];
$this->redirect('resetSuccess');
}
}
//跳转错误页面
$this->redirect('/error/index');
}
/**
... ... @@ -157,14 +171,15 @@ class BackController extends WebAction
}
/**
* 手机验证
* 手机验证页面
*/
public function verificationAction() {
$phoneNum = $this->getSession('phoneNum');
$area = $this->getSession('area');
// if(empty($phoneNum)) {
// $this->redirect('index');
// }
$captcha = $this->getSession('captcha');
if(empty($phoneNum)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
... ... @@ -174,6 +189,7 @@ class BackController extends WebAction
'coverImg' => $banner['img'],
'phoneNum' => $phoneNum,
'area' => $area,
'captcha'=> $captcha,
'countrys' => array()
)
);
... ... @@ -181,6 +197,32 @@ class BackController extends WebAction
}
/**
* 手机找回密码验证
*/
public function backmobileAction()
{
$mobile = $this->post('mobile');//phoneNum
$area = $this->post('area');
//$captcha = $this->post('captcha');
$code = $this->post('captcha');//code
if($this->getSession('phoneNum') == $mobile && $this->getSession('area') == $area)
{
$result = BackData::validateMobileCode($mobile, $code, $area);
if($result['code'] == 200) {
$str = json_encode(array(
'mobile'=> $mobile,
'area' => $area,
'token'=> $result['data']['token'],
'create_time' => time()
));
$code = AuthCode::encode($str, PassportModel::BACK_FIND_SECRET_KEY);
$url = '/passport/back/backcode?code='.base64_encode($code);
$this->redirect(SITE_MAIN.$url);
}
}
}
/**
* 检查code
*
* @param string $code
... ... @@ -188,9 +230,8 @@ class BackController extends WebAction
*/
private function checkCode($code)
{
$key = '_+@#$%^';
$code = base64_decode($code);
$info = json_decode(AuthCode::decode($code, $key), true);
$info = json_decode(AuthCode::decode($code, PassportModel::BACK_FIND_SECRET_KEY), true);
if ($info['create_time'] < 1 || (time() - $info['create_time']) > 86400) {
return array();
}
... ...