Authored by whb

找回密码

@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 {{/ countryList}} 15 {{/ countryList}}
16 </ul> 16 </ul>
17 </div> 17 </div>
18 - <form id="back-form" class="back-form" action=""> 18 + <form id="back-form" class="back-form" action="/passport/back/email" method="post">
19 <input id="country-code-hide" type="hidden" name="country-code" value="+86"> 19 <input id="country-code-hide" type="hidden" name="country-code" value="+86">
20 <ul> 20 <ul>
21 <li class="input-container-li clearfix"> 21 <li class="input-container-li clearfix">
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 </li> 28 </li>
29 <li class="input-container-li clearfix"> 29 <li class="input-container-li clearfix">
30 <input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="验证码" autocomplete="off" maxlength="4"> 30 <input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="验证码" autocomplete="off" maxlength="4">
31 - <img id="captcha-img" class="captcha-img" src="http://www.yohobuy.com/passport/images" alt=""> 31 + <img id="captcha-img" class="captcha-img" src="http://web.dev.yohobuy.com/passport/images" alt="">
32 <a id="change-captcha" class="link change-captcha">换一张</a> 32 <a id="change-captcha" class="link change-captcha">换一张</a>
33 <span id="captcha-err" class="err-tip captcha-err hide"> 33 <span id="captcha-err" class="err-tip captcha-err hide">
34 <i></i> 34 <i></i>
@@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
3 namespace Passport; 3 namespace Passport;
4 4
5 use Plugin\Helpers; 5 use Plugin\Helpers;
  6 +use LibModels\Web\Home\IndexData;
  7 +use LibModels\Web\Passport\RegData;
  8 +use Plugin\Images;
  9 +use Plugin\Captcha;
6 10
7 /** 11 /**
8 * web登录注册等相关数据构建 12 * web登录注册等相关数据构建
@@ -16,6 +20,9 @@ use Plugin\Helpers; @@ -16,6 +20,9 @@ use Plugin\Helpers;
16 class PassportModel 20 class PassportModel
17 { 21 {
18 22
  23 + const REGISTER_LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';//注册左边的banner
  24 + const BACK_LFFT_BANNER_CODE = '3bbaf502c447a2ddad60879042e286d8';//找回密码左边的banner
  25 +
19 //简单头部 26 //简单头部
20 public static function getSimpleHeader($isLogin, $username = '') 27 public static function getSimpleHeader($isLogin, $username = '')
21 { 28 {
@@ -50,4 +57,58 @@ class PassportModel @@ -50,4 +57,58 @@ class PassportModel
50 return $simpleHeader; 57 return $simpleHeader;
51 } 58 }
52 59
  60 + /**
  61 + * 获取左侧banner
  62 + *
  63 + * @param string $code
  64 + * @return array
  65 + */
  66 + public static function getLeftBanner($code)
  67 + {
  68 + $ret = array('img'=>'','url'=>'');
  69 + $resource = IndexData::getResourceData($code);
  70 + if(isset($resource['data'][0]))
  71 + {
  72 + $val = current($resource['data'][0]['data']);
  73 + $ret['img'] = Images::getImageUrl($val['src'], 252, 190);
  74 + $ret['url'] = $val['url'];
  75 + }
  76 + return $ret;
  77 + }
  78 +
  79 + /**
  80 + * 校验验证码
  81 + *
  82 + * @param string $verifyCode
  83 + * @return boolean
  84 + */
  85 + public static function verifyCode($verifyCode)
  86 + {
  87 + $verifyCode = strtolower($verifyCode);
  88 + $ret = true;
  89 + //检测验证码不正确
  90 + if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) {
  91 + $ret = false;
  92 + }
  93 + return $ret;
  94 + }
  95 +
  96 + /**
  97 + * 根据手机号获取用户信息
  98 + *
  99 + * @param string $area
  100 + * @param string $mobile
  101 + * @return array
  102 + */
  103 + public static function getUserInfoByMobile($area, $mobile) {
  104 + $ret = array();
  105 + $data = RegData::getUserInfoByMobile($area, $mobile);
  106 + if($data['code'] == 200) {
  107 + if(!empty($data['data'])) {
  108 + $ret = current($data['data']);
  109 + }
  110 + }
  111 + return $ret;
  112 + }
  113 +
53 } 114 }
1 -<?php  
2 -namespace Passport;  
3 -use LibModels\Web\Home\IndexData;  
4 -use LibModels\Web\Passport\RegData;  
5 -use Plugin\Images;  
6 -use Plugin\Captcha;  
7 -class RegModel  
8 -{  
9 - const LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';  
10 -  
11 - /**  
12 - * 获取左侧banner  
13 - *  
14 - * @return array  
15 - */  
16 - public static function getLeftBanner()  
17 - {  
18 - $ret = array('img'=>'','url'=>'');  
19 - $resource = IndexData::getResourceData(self::LEFT_BANNER_CODE);  
20 - if(isset($resource['data'][0]))  
21 - {  
22 - $val = current($resource['data'][0]['data']);  
23 - $ret['img'] = Images::getImageUrl($val['src'], 252, 190);  
24 - $ret['url'] = $val['url'];  
25 - }  
26 - return $ret;  
27 - }  
28 -  
29 - /**  
30 - * 校验验证码  
31 - *  
32 - * @param string $verifyCode  
33 - * @return boolean  
34 - */  
35 - public static function verifyCode($verifyCode)  
36 - {  
37 - $verifyCode = strtolower($verifyCode);  
38 - $ret = true;  
39 - //检测验证码不正确  
40 - if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) {  
41 - $ret = false;  
42 - }  
43 - return $ret;  
44 - }  
45 -  
46 - /**  
47 - * 根据手机号获取用户信息  
48 - *  
49 - * @param string $area  
50 - * @param string $mobile  
51 - * @return array  
52 - */  
53 - public static function getUserInfoByMobile($area, $mobile) {  
54 - $ret = array();  
55 - $data = RegData::getUserInfoByMobile($area, $mobile);  
56 - if($data['code'] == 200) {  
57 - if(!empty($data['data'])) {  
58 - $ret = current($data['data']);  
59 - }  
60 - }  
61 - return $ret;  
62 - }  
63 -}  
1 <?php 1 <?php
  2 +use Action\WebAction;
  3 +use LibModels\Web\Passport\RegData;
  4 +use Passport\PassportModel;
  5 +use Plugin\Helpers;
2 6
3 -use Action\AbstractAction;  
4 -  
5 -class BackController extends AbstractAction 7 +class BackController extends WebAction
6 { 8 {
7 /** 9 /**
8 * 找回密码 10 * 找回密码
9 */ 11 */
10 public function indexAction() 12 public function indexAction()
11 { 13 {
12 -  
13 - $simpleHeader = array(  
14 - 'logo' => array(  
15 - 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',  
16 - 'url' => 'http://www.yohobuy.com'  
17 - ),  
18 - 'tool' => array(  
19 - 'user' => '2586703@qq.com',  
20 - 'userCenter' => '',  
21 - 'loginHref' => '',  
22 - 'registerHref' => '',  
23 - 'favoriteHref' => '',  
24 - 'couponHref' => '',  
25 - 'orderHref' => '',  
26 - 'helpHref' => ''  
27 - )  
28 - ); 14 + $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
29 $data = array( 15 $data = array(
30 - 'simpleHeader' => $simpleHeader, 16 + 'simpleHeader' => PassportModel::getSimpleHeader(false),
31 'backPage' => true, 17 'backPage' => true,
32 'back' => array( 18 'back' => array(
33 - 'coverHref' => '/passport',  
34 - 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', 19 + 'coverHref' => $banner['url'],
  20 + 'coverImg' => $banner['img'],
35 'countryCode' => '86', 21 'countryCode' => '86',
36 'countryName' => '中国', 22 'countryName' => '中国',
37 - 'countryList' => array(  
38 - array(  
39 - 'code' => '61',  
40 - 'name' => '澳大利亚'  
41 - ),  
42 - array(  
43 - 'code' => '82',  
44 - 'name' => '韩国'  
45 - ),  
46 - array(  
47 - 'code' => '1',  
48 - 'name' => '加拿大'  
49 - ),  
50 - array(  
51 - 'code' => '86',  
52 - 'name' => '中国'  
53 - )  
54 - ) 23 + 'countryList' => RegData::getAreasData(),
55 ) 24 )
56 ); 25 );
57 $this->_view->display('index', $data); 26 $this->_view->display('index', $data);
58 } 27 }
59 28
  29 + public function authcodeAction()
  30 + {
  31 + echo $this->echoJson(array('code'=> 200));
  32 + }
  33 +
  34 + /**
  35 + *
  36 + */
  37 + public function emailAction()
  38 + {
  39 + $phoneNum = $this->post('phoneNum','');
  40 + $captcha = $this->post('captcha','');
  41 + if(Helpers::verifyEmail($phoneNum)){ //验证邮箱
  42 + $email = $phoneNum;
  43 + $this->redirect('sendemail');
  44 + } else if(Helpers::verifyMobile($phoneNum)) {//验证手机号
  45 + $mobile = $phoneNum;
  46 + $this->redirect('verification');
  47 + }
  48 + }
  49 +
60 /** 50 /**
61 * 发送邮件 51 * 发送邮件
62 */ 52 */
  1 +<?php
  2 +
  3 +use Action\AbstractAction;
  4 +
  5 +class BackController extends AbstractAction
  6 +{
  7 + /**
  8 + * 找回密码
  9 + */
  10 + public function indexAction()
  11 + {
  12 +
  13 + $simpleHeader = array(
  14 + 'logo' => array(
  15 + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
  16 + 'url' => 'http://www.yohobuy.com'
  17 + ),
  18 + 'tool' => array(
  19 + 'user' => '2586703@qq.com',
  20 + 'userCenter' => '',
  21 + 'loginHref' => '',
  22 + 'registerHref' => '',
  23 + 'favoriteHref' => '',
  24 + 'couponHref' => '',
  25 + 'orderHref' => '',
  26 + 'helpHref' => ''
  27 + )
  28 + );
  29 + $data = array(
  30 + 'simpleHeader' => $simpleHeader,
  31 + 'backPage' => true,
  32 + 'back' => array(
  33 + 'coverHref' => '/passport',
  34 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
  35 + 'countryCode' => '86',
  36 + 'countryName' => '中国',
  37 + 'countryList' => array(
  38 + array(
  39 + 'code' => '61',
  40 + 'name' => '澳大利亚'
  41 + ),
  42 + array(
  43 + 'code' => '82',
  44 + 'name' => '韩国'
  45 + ),
  46 + array(
  47 + 'code' => '1',
  48 + 'name' => '加拿大'
  49 + ),
  50 + array(
  51 + 'code' => '86',
  52 + 'name' => '中国'
  53 + )
  54 + )
  55 + )
  56 + );
  57 + $this->_view->display('index', $data);
  58 + }
  59 +
  60 + /**
  61 + * 发送邮件
  62 + */
  63 + public function sendemailAction() {
  64 + $simpleHeader = array(
  65 + 'logo' => array(
  66 + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
  67 + 'url' => 'http://www.yohobuy.com'
  68 + ),
  69 + 'tool' => array(
  70 + 'user' => '2586703@qq.com',
  71 + 'userCenter' => '',
  72 + 'loginHref' => '',
  73 + 'logoutHref' => '',
  74 + 'registerHref' => '',
  75 + 'favoriteHref' => '',
  76 + 'couponHref' => '',
  77 + 'orderHref' => '',
  78 + 'helpHref' => ''
  79 + )
  80 + );
  81 + $data = array(
  82 + 'simpleHeader' => $simpleHeader,
  83 + 'sendEmail' => array(
  84 + 'coverHref' => '/passport',
  85 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
  86 + 'countrys' => array()
  87 + )
  88 + );
  89 + $this->_view->display('send-email', $data);
  90 + }
  91 +
  92 + /**
  93 + * 重置密码
  94 + */
  95 + public function resetPwdAction() {
  96 + $simpleHeader = array(
  97 + 'logo' => array(
  98 + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
  99 + 'url' => 'http://www.yohobuy.com'
  100 + ),
  101 + 'tool' => array(
  102 + 'user' => '2586703@qq.com',
  103 + 'userCenter' => '',
  104 + 'loginHref' => '',
  105 + 'logoutHref' => '',
  106 + 'registerHref' => '',
  107 + 'favoriteHref' => '',
  108 + 'couponHref' => '',
  109 + 'orderHref' => '',
  110 + 'helpHref' => ''
  111 + )
  112 + );
  113 + $data = array(
  114 + 'simpleHeader' => $simpleHeader,
  115 + 'resetPage' => true,
  116 + 'resetPwd' => array(
  117 + 'coverHref' => '/passport',
  118 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
  119 + 'countrys' => array()
  120 + )
  121 + );
  122 + $this->_view->display('reset-pwd', $data);
  123 + }
  124 +
  125 + public function resetSuccessAction() {
  126 + $simpleHeader = array(
  127 + 'logo' => array(
  128 + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
  129 + 'url' => 'http://www.yohobuy.com'
  130 + ),
  131 + 'tool' => array(
  132 + 'user' => '2586703@qq.com',
  133 + 'userCenter' => '',
  134 + 'loginHref' => '',
  135 + 'logoutHref' => '',
  136 + 'registerHref' => '',
  137 + 'favoriteHref' => '',
  138 + 'couponHref' => '',
  139 + 'orderHref' => '',
  140 + 'helpHref' => ''
  141 + )
  142 + );
  143 + $data = array(
  144 + 'simpleHeader' => $simpleHeader,
  145 + 'resetSuccess' => array(
  146 + 'coverHref' => '/passport',
  147 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
  148 + 'countrys' => array()
  149 + )
  150 + );
  151 + $this->_view->display('reset-success', $data);
  152 + }
  153 +
  154 + public function verificationAction() {
  155 + $simpleHeader = array(
  156 + 'logo' => array(
  157 + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
  158 + 'url' => 'http://www.yohobuy.com'
  159 + ),
  160 + 'tool' => array(
  161 + 'user' => '2586703@qq.com',
  162 + 'userCenter' => '',
  163 + 'loginHref' => '',
  164 + 'logoutHref' => '',
  165 + 'registerHref' => '',
  166 + 'favoriteHref' => '',
  167 + 'couponHref' => '',
  168 + 'orderHref' => '',
  169 + 'helpHref' => ''
  170 + )
  171 + );
  172 + $data = array(
  173 + 'simpleHeader' => $simpleHeader,
  174 + 'vertificationPage' => true,
  175 + 'verification' => array(
  176 + 'coverHref' => '/passport',
  177 + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
  178 + 'countrys' => array()
  179 + )
  180 + );
  181 + $this->_view->display('verification', $data);
  182 + }
  183 +}
@@ -4,6 +4,7 @@ use LibModels\Web\Passport\RegData; @@ -4,6 +4,7 @@ use LibModels\Web\Passport\RegData;
4 use Passport\RegModel; 4 use Passport\RegModel;
5 use Plugin\Helpers; 5 use Plugin\Helpers;
6 use Plugin\Cache; 6 use Plugin\Cache;
  7 +use Passport\PassportModel;
7 class RegisterController extends WebAction 8 class RegisterController extends WebAction
8 { 9 {
9 /** 10 /**
@@ -12,7 +13,7 @@ class RegisterController extends WebAction @@ -12,7 +13,7 @@ class RegisterController extends WebAction
12 public function indexAction() 13 public function indexAction()
13 { 14 {
14 $refer = $this->get('refer', SITE_MAIN); 15 $refer = $this->get('refer', SITE_MAIN);
15 - $cover = RegModel::getLeftBanner(); 16 + $cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
16 $data = array( 17 $data = array(
17 'registerPage' => true, 18 'registerPage' => true,
18 'passport' => array( 19 'passport' => array(
@@ -55,7 +56,7 @@ class RegisterController extends WebAction @@ -55,7 +56,7 @@ class RegisterController extends WebAction
55 $data['message'] = '由于你IP受限无法注册'; 56 $data['message'] = '由于你IP受限无法注册';
56 break; 57 break;
57 } 58 }
58 - if(!empty(RegModel::getUserInfoByMobile($area, $mobile))) { 59 + if(!empty(PassportModel::getUserInfoByMobile($area, $mobile))) {
59 $data['message'] = '手机号码已经存在'; 60 $data['message'] = '手机号码已经存在';
60 break; 61 break;
61 } 62 }
@@ -88,7 +89,7 @@ class RegisterController extends WebAction @@ -88,7 +89,7 @@ class RegisterController extends WebAction
88 break; 89 break;
89 } 90 }
90 //检测验证码不正确 91 //检测验证码不正确
91 - if(!RegModel::verifyCode($verifyCode)) { 92 + if(!PassportModel::verifyCode($verifyCode)) {
92 $data['message'] = '验证码不正确'; 93 $data['message'] = '验证码不正确';
93 break; 94 break;
94 } 95 }
@@ -133,7 +134,7 @@ class RegisterController extends WebAction @@ -133,7 +134,7 @@ class RegisterController extends WebAction
133 break; 134 break;
134 } 135 }
135 //检测验证码不正确 136 //检测验证码不正确
136 - if(!RegModel::verifyCode($verifyCode)) { 137 + if(!PassportModel::verifyCode($verifyCode)) {
137 $data['message'] = '验证码不正确'; 138 $data['message'] = '验证码不正确';
138 break; 139 break;
139 } 140 }