Authored by whb

找回密码

... ... @@ -15,7 +15,7 @@
{{/ countryList}}
</ul>
</div>
<form id="back-form" class="back-form" action="">
<form id="back-form" class="back-form" action="/passport/back/email" method="post">
<input id="country-code-hide" type="hidden" name="country-code" value="+86">
<ul>
<li class="input-container-li clearfix">
... ... @@ -28,7 +28,7 @@
</li>
<li class="input-container-li clearfix">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="http://www.yohobuy.com/passport/images" alt="">
<img id="captcha-img" class="captcha-img" src="http://web.dev.yohobuy.com/passport/images" alt="">
<a id="change-captcha" class="link change-captcha">换一张</a>
<span id="captcha-err" class="err-tip captcha-err hide">
<i></i>
... ...
... ... @@ -3,6 +3,10 @@
namespace Passport;
use Plugin\Helpers;
use LibModels\Web\Home\IndexData;
use LibModels\Web\Passport\RegData;
use Plugin\Images;
use Plugin\Captcha;
/**
* web登录注册等相关数据构建
... ... @@ -16,6 +20,9 @@ use Plugin\Helpers;
class PassportModel
{
const REGISTER_LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';//注册左边的banner
const BACK_LFFT_BANNER_CODE = '3bbaf502c447a2ddad60879042e286d8';//找回密码左边的banner
//简单头部
public static function getSimpleHeader($isLogin, $username = '')
{
... ... @@ -50,4 +57,58 @@ class PassportModel
return $simpleHeader;
}
/**
* 获取左侧banner
*
* @param string $code
* @return array
*/
public static function getLeftBanner($code)
{
$ret = array('img'=>'','url'=>'');
$resource = IndexData::getResourceData($code);
if(isset($resource['data'][0]))
{
$val = current($resource['data'][0]['data']);
$ret['img'] = Images::getImageUrl($val['src'], 252, 190);
$ret['url'] = $val['url'];
}
return $ret;
}
/**
* 校验验证码
*
* @param string $verifyCode
* @return boolean
*/
public static function verifyCode($verifyCode)
{
$verifyCode = strtolower($verifyCode);
$ret = true;
//检测验证码不正确
if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) {
$ret = false;
}
return $ret;
}
/**
* 根据手机号获取用户信息
*
* @param string $area
* @param string $mobile
* @return array
*/
public static function getUserInfoByMobile($area, $mobile) {
$ret = array();
$data = RegData::getUserInfoByMobile($area, $mobile);
if($data['code'] == 200) {
if(!empty($data['data'])) {
$ret = current($data['data']);
}
}
return $ret;
}
}
... ...
<?php
namespace Passport;
use LibModels\Web\Home\IndexData;
use LibModels\Web\Passport\RegData;
use Plugin\Images;
use Plugin\Captcha;
class RegModel
{
const LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';
/**
* 获取左侧banner
*
* @return array
*/
public static function getLeftBanner()
{
$ret = array('img'=>'','url'=>'');
$resource = IndexData::getResourceData(self::LEFT_BANNER_CODE);
if(isset($resource['data'][0]))
{
$val = current($resource['data'][0]['data']);
$ret['img'] = Images::getImageUrl($val['src'], 252, 190);
$ret['url'] = $val['url'];
}
return $ret;
}
/**
* 校验验证码
*
* @param string $verifyCode
* @return boolean
*/
public static function verifyCode($verifyCode)
{
$verifyCode = strtolower($verifyCode);
$ret = true;
//检测验证码不正确
if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) {
$ret = false;
}
return $ret;
}
/**
* 根据手机号获取用户信息
*
* @param string $area
* @param string $mobile
* @return array
*/
public static function getUserInfoByMobile($area, $mobile) {
$ret = array();
$data = RegData::getUserInfoByMobile($area, $mobile);
if($data['code'] == 200) {
if(!empty($data['data'])) {
$ret = current($data['data']);
}
}
return $ret;
}
}
\ No newline at end of file
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\PassportModel;
use Plugin\Helpers;
use Action\AbstractAction;
class BackController extends AbstractAction
class BackController extends WebAction
{
/**
* 找回密码
*/
public function indexAction()
{
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => $simpleHeader,
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countryCode' => '86',
'countryName' => '中国',
'countryList' => array(
array(
'code' => '61',
'name' => '澳大利亚'
),
array(
'code' => '82',
'name' => '韩国'
),
array(
'code' => '1',
'name' => '加拿大'
),
array(
'code' => '86',
'name' => '中国'
)
)
'countryList' => RegData::getAreasData(),
)
);
$this->_view->display('index', $data);
}
public function authcodeAction()
{
echo $this->echoJson(array('code'=> 200));
}
/**
*
*/
public function emailAction()
{
$phoneNum = $this->post('phoneNum','');
$captcha = $this->post('captcha','');
if(Helpers::verifyEmail($phoneNum)){ //验证邮箱
$email = $phoneNum;
$this->redirect('sendemail');
} else if(Helpers::verifyMobile($phoneNum)) {//验证手机号
$mobile = $phoneNum;
$this->redirect('verification');
}
}
/**
* 发送邮件
*/
... ...
<?php
use Action\AbstractAction;
class BackController extends AbstractAction
{
/**
* 找回密码
*/
public function indexAction()
{
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => $simpleHeader,
'backPage' => true,
'back' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countryCode' => '86',
'countryName' => '中国',
'countryList' => array(
array(
'code' => '61',
'name' => '澳大利亚'
),
array(
'code' => '82',
'name' => '韩国'
),
array(
'code' => '1',
'name' => '加拿大'
),
array(
'code' => '86',
'name' => '中国'
)
)
)
);
$this->_view->display('index', $data);
}
/**
* 发送邮件
*/
public function sendemailAction() {
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'logoutHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => $simpleHeader,
'sendEmail' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countrys' => array()
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码
*/
public function resetPwdAction() {
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'logoutHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => $simpleHeader,
'resetPage' => true,
'resetPwd' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countrys' => array()
)
);
$this->_view->display('reset-pwd', $data);
}
public function resetSuccessAction() {
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'logoutHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => $simpleHeader,
'resetSuccess' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countrys' => array()
)
);
$this->_view->display('reset-success', $data);
}
public function verificationAction() {
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'logoutHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => $simpleHeader,
'vertificationPage' => true,
'verification' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countrys' => array()
)
);
$this->_view->display('verification', $data);
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ use LibModels\Web\Passport\RegData;
use Passport\RegModel;
use Plugin\Helpers;
use Plugin\Cache;
use Passport\PassportModel;
class RegisterController extends WebAction
{
/**
... ... @@ -12,7 +13,7 @@ class RegisterController extends WebAction
public function indexAction()
{
$refer = $this->get('refer', SITE_MAIN);
$cover = RegModel::getLeftBanner();
$cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
$data = array(
'registerPage' => true,
'passport' => array(
... ... @@ -55,7 +56,7 @@ class RegisterController extends WebAction
$data['message'] = '由于你IP受限无法注册';
break;
}
if(!empty(RegModel::getUserInfoByMobile($area, $mobile))) {
if(!empty(PassportModel::getUserInfoByMobile($area, $mobile))) {
$data['message'] = '手机号码已经存在';
break;
}
... ... @@ -88,7 +89,7 @@ class RegisterController extends WebAction
break;
}
//检测验证码不正确
if(!RegModel::verifyCode($verifyCode)) {
if(!PassportModel::verifyCode($verifyCode)) {
$data['message'] = '验证码不正确';
break;
}
... ... @@ -133,7 +134,7 @@ class RegisterController extends WebAction
break;
}
//检测验证码不正确
if(!RegModel::verifyCode($verifyCode)) {
if(!PassportModel::verifyCode($verifyCode)) {
$data['message'] = '验证码不正确';
break;
}
... ...