Showing
3 changed files
with
74 additions
and
24 deletions
@@ -55,7 +55,7 @@ class Call extends Factory | @@ -55,7 +55,7 @@ class Call extends Factory | ||
55 | 55 | ||
56 | try | 56 | try |
57 | { | 57 | { |
58 | - $token = $this->renn->getTokenFromTokenEndpoint('code', $keys, TokenType::Bearer); | 58 | + $token = $this->renn->getTokenFromTokenEndpoint('code', $keys, \TokenType::Bearer); |
59 | 59 | ||
60 | // 返回数组格式的信息 | 60 | // 返回数组格式的信息 |
61 | $token = $this->renn->getTokens(); | 61 | $token = $this->renn->getTokens(); |
@@ -84,7 +84,7 @@ class Call extends Factory | @@ -84,7 +84,7 @@ class Call extends Factory | ||
84 | { | 84 | { |
85 | if (is_array($token)) | 85 | if (is_array($token)) |
86 | { | 86 | { |
87 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 87 | + $token = new \AccessToken(isset($token['token_type']) ? $token['token_type'] : \TokenType::Bearer, $token['access_token'], isset($token['refresh_token']) ? $token['refresh_token'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
88 | } | 88 | } |
89 | // 获得保存的token | 89 | // 获得保存的token |
90 | $this->renn->authWithToken($token); | 90 | $this->renn->authWithToken($token); |
@@ -130,7 +130,7 @@ class Call extends Factory | @@ -130,7 +130,7 @@ class Call extends Factory | ||
130 | { | 130 | { |
131 | if (is_array($token)) | 131 | if (is_array($token)) |
132 | { | 132 | { |
133 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 133 | + $token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
134 | } | 134 | } |
135 | // 获得保存的token | 135 | // 获得保存的token |
136 | $this->renn->authWithToken($token); | 136 | $this->renn->authWithToken($token); |
@@ -178,7 +178,7 @@ class Call extends Factory | @@ -178,7 +178,7 @@ class Call extends Factory | ||
178 | { | 178 | { |
179 | if (is_array($token)) | 179 | if (is_array($token)) |
180 | { | 180 | { |
181 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 181 | + $token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
182 | } | 182 | } |
183 | // 获得保存的token | 183 | // 获得保存的token |
184 | $this->renn->authWithToken($token); | 184 | $this->renn->authWithToken($token); |
@@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction | @@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction | ||
50 | 'actionUrl' => Helpers::url('/autouserinfo/bind'), | 50 | 'actionUrl' => Helpers::url('/autouserinfo/bind'), |
51 | 'region' => RegData::getAreasData(), | 51 | 'region' => RegData::getAreasData(), |
52 | 'location' => '+86', | 52 | 'location' => '+86', |
53 | - 'captchaUrl' => '/passport/images?t=1449799445', | 53 | + 'captchaUrl' => Helpers::url('/passport/images?t=' . time()), |
54 | 'itemUrl' => Helpers::url('/help/?category_id=9'), | 54 | 'itemUrl' => Helpers::url('/help/?category_id=9'), |
55 | 'referUrl' => $refer, | 55 | 'referUrl' => $refer, |
56 | 'skipUrl' => SITE_MAIN, | 56 | 'skipUrl' => SITE_MAIN, |
@@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction | @@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction | ||
71 | public function userInfoAction() | 71 | public function userInfoAction() |
72 | { | 72 | { |
73 | //获取用户 | 73 | //获取用户 |
74 | - $uid = $this->getUid(true); | 74 | + $uid = $this->getUid(false); |
75 | $nickname = $this->get('nickname'); | 75 | $nickname = $this->get('nickname'); |
76 | $openId = $this->get('openId'); | 76 | $openId = $this->get('openId'); |
77 | $sourceType = $this->get('sourceType'); | 77 | $sourceType = $this->get('sourceType'); |
@@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction | @@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction | ||
113 | break; | 113 | break; |
114 | } | 114 | } |
115 | 115 | ||
116 | - $phoneNum = trim($this->post('phoneNum')); | 116 | + $phoneNum = trim($this->post('mobile')); |
117 | $openId = trim($this->post('openId')); | 117 | $openId = trim($this->post('openId')); |
118 | - $areaCode = trim($this->post('areaCode', '86')); | 118 | + $areaCode = trim($this->post('area', '86')); |
119 | $sourceType = trim($this->post('sourceType')); | 119 | $sourceType = trim($this->post('sourceType')); |
120 | 120 | ||
121 | 121 | ||
@@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction | @@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction | ||
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | 154 | ||
155 | - $phoneNum = trim($this->post('phoneNum')); | ||
156 | - $areaCode = trim($this->post('areaCode')); | 155 | + $phoneNum = trim($this->post('mobile')); |
156 | + $areaCode = trim($this->post('area')); | ||
157 | $verifyCode = trim($this->post('verifyCode')); | 157 | $verifyCode = trim($this->post('verifyCode')); |
158 | 158 | ||
159 | //校验手机号格式 | 159 | //校验手机号格式 |
160 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 160 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
161 | - $data['code'] = 401; | 161 | + $data['code'] = 400; |
162 | $data['message'] = '手机号码格式不正确'; | 162 | $data['message'] = '手机号码格式不正确'; |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | 165 | ||
166 | //检测验证码不正确 | 166 | //检测验证码不正确 |
167 | if (!PassportModel::verifyCode($verifyCode)) { | 167 | if (!PassportModel::verifyCode($verifyCode)) { |
168 | - $data['code'] = 402; | 168 | + $data['code'] = 400; |
169 | $data['message'] = '图形验证码不正确'; | 169 | $data['message'] = '图形验证码不正确'; |
170 | break; | 170 | break; |
171 | } | 171 | } |
@@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction | @@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction | ||
183 | /* | 183 | /* |
184 | * 校验图形验证码 | 184 | * 校验图形验证码 |
185 | */ | 185 | */ |
186 | - | ||
187 | public function checkPicCodeAction() | 186 | public function checkPicCodeAction() |
188 | { | 187 | { |
189 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 188 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
@@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction | @@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction | ||
193 | if (!$this->isAjax()) { | 192 | if (!$this->isAjax()) { |
194 | break; | 193 | break; |
195 | } | 194 | } |
196 | - $verifyCode = $phoneNum = trim($this->post('verifyCode')); | 195 | + $verifyCode = trim($this->post('verifyCode')); |
197 | $picFlag = PassportModel::verifyCode($verifyCode); | 196 | $picFlag = PassportModel::verifyCode($verifyCode); |
198 | if ($picFlag) { | 197 | if ($picFlag) { |
199 | $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); | 198 | $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); |
@@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction | @@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction | ||
220 | break; | 219 | break; |
221 | } | 220 | } |
222 | 221 | ||
223 | - $phoneNum = trim($this->post('phoneNum')); | ||
224 | - $areaCode = trim($this->post('areaCode')); | 222 | + $phoneNum = trim($this->post('mobile')); |
223 | + $areaCode = trim($this->post('area')); | ||
225 | $code = trim($this->post('code')); //短信验证码 | 224 | $code = trim($this->post('code')); //短信验证码 |
226 | //校验手机号格式 | 225 | //校验手机号格式 |
227 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 226 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
@@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction | @@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction | ||
253 | break; | 252 | break; |
254 | } | 253 | } |
255 | 254 | ||
256 | - $phoneNum = trim($this->post('phoneNum')); | ||
257 | - $areaCode = trim($this->post('areaCode', '86')); | 255 | + $phoneNum = trim($this->post('mobile')); |
256 | + $areaCode = trim($this->post('area', '86')); | ||
258 | $openId = trim($this->post('openId')); | 257 | $openId = trim($this->post('openId')); |
259 | $sourceType = trim($this->post('sourceType')); | 258 | $sourceType = trim($this->post('sourceType')); |
260 | $code = trim($this->post('code')); //短信验证码 | 259 | $code = trim($this->post('code')); //短信验证码 |
@@ -73,15 +73,40 @@ class RegisterController extends WebAction | @@ -73,15 +73,40 @@ class RegisterController extends WebAction | ||
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | - * 校验并发送验证码 | 76 | + * 校验图形验证码 |
77 | * | 77 | * |
78 | * @return json | 78 | * @return json |
79 | */ | 79 | */ |
80 | public function piccaptchaAction() | 80 | public function piccaptchaAction() |
81 | { | 81 | { |
82 | + $data = array('code' => 400, 'message' => '', 'data' => ''); | ||
83 | + | ||
84 | + do { | ||
85 | + /* 判断是不是AJAX请求 */ | ||
86 | + if (!$this->isAjax()) { | ||
87 | + break; | ||
88 | + } | ||
89 | + $verifyCode = trim($this->post('verifyCode')); | ||
90 | + $picFlag = PassportModel::verifyCode($verifyCode); | ||
91 | + if ($picFlag) { | ||
92 | + $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); | ||
93 | + } | ||
94 | + else { | ||
95 | + $data = array('code' => 400, 'message' => '验证码错误', 'data' => ''); | ||
96 | + } | ||
97 | + } | ||
98 | + while (false); | ||
99 | + | ||
100 | + $this->echoJson($data); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * 发送短信验证码 | ||
105 | + */ | ||
106 | + public function sendBindMsgAction(){ | ||
82 | $mobile = trim($this->post('mobile'), ' '); | 107 | $mobile = trim($this->post('mobile'), ' '); |
83 | $area = intval(trim($this->post('area'), ' ')); | 108 | $area = intval(trim($this->post('area'), ' ')); |
84 | - $verifyCode = strtolower(trim($this->post('code'),' ')); | 109 | + $verifyCode = strtolower(trim($this->post('verifyCode'),' ')); |
85 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 110 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
86 | do | 111 | do |
87 | { | 112 | { |
@@ -91,13 +116,14 @@ class RegisterController extends WebAction | @@ -91,13 +116,14 @@ class RegisterController extends WebAction | ||
91 | } | 116 | } |
92 | /* 判断参数是否合法 */ | 117 | /* 判断参数是否合法 */ |
93 | if (!is_numeric($mobile) || !is_numeric($area)) { | 118 | if (!is_numeric($mobile) || !is_numeric($area)) { |
94 | - $code = 400; | 119 | + $data['code'] = 400; |
95 | $data['message'] = '手机号码格式不正确'; | 120 | $data['message'] = '手机号码格式不正确'; |
96 | break; | 121 | break; |
97 | } | 122 | } |
98 | //检测验证码不正确 | 123 | //检测验证码不正确 |
99 | if(!PassportModel::verifyCode($verifyCode)) { | 124 | if(!PassportModel::verifyCode($verifyCode)) { |
100 | - $data['message'] = '验证码不正确'; | 125 | + $data['code'] = 400; |
126 | + $data['message'] = '图形验证码不正确'; | ||
101 | break; | 127 | break; |
102 | } | 128 | } |
103 | //发送代码 | 129 | //发送代码 |
@@ -119,7 +145,32 @@ class RegisterController extends WebAction | @@ -119,7 +145,32 @@ class RegisterController extends WebAction | ||
119 | 145 | ||
120 | public function msgcaptchaAction() | 146 | public function msgcaptchaAction() |
121 | { | 147 | { |
122 | - $this->echoJson(array('code'=>200)); | 148 | + $data = array('code' => 400, 'message' => '', 'data' => ''); |
149 | + | ||
150 | + do { | ||
151 | + /* 判断是不是AJAX请求 */ | ||
152 | + if (!$this->isAjax()) { | ||
153 | + break; | ||
154 | + } | ||
155 | + | ||
156 | + $phoneNum = trim($this->post('mobile')); | ||
157 | + $areaCode = trim($this->post('area')); | ||
158 | + $code = trim($this->post('code')); //短信验证码 | ||
159 | + //校验手机号格式 | ||
160 | + if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | ||
161 | + $data['code'] = 401; | ||
162 | + $data['message'] = '手机号码格式不正确'; | ||
163 | + break; | ||
164 | + } | ||
165 | + | ||
166 | + $data = BindData::checkBindCode($areaCode, $phoneNum, $code); | ||
167 | + if (!isset($data['code'])) { | ||
168 | + break; | ||
169 | + } | ||
170 | + } | ||
171 | + while (false); | ||
172 | + | ||
173 | + $this->echoJson($data); | ||
123 | } | 174 | } |
124 | 175 | ||
125 | /** | 176 | /** |
@@ -130,7 +181,7 @@ class RegisterController extends WebAction | @@ -130,7 +181,7 @@ class RegisterController extends WebAction | ||
130 | { | 181 | { |
131 | $mobile = trim($this->post('mobile'), ' ');//mobile | 182 | $mobile = trim($this->post('mobile'), ' ');//mobile |
132 | $area = intval(trim($this->post('area'), ' '));//area | 183 | $area = intval(trim($this->post('area'), ' '));//area |
133 | - $verifyCode = strtolower(trim($this->post('captcha'),' '));//captcha | 184 | + $verifyCode = strtolower(trim($this->post('verifyCode'),' '));//图形验证码 |
134 | $code = trim($this->post('code'),'');//code | 185 | $code = trim($this->post('code'),'');//code |
135 | $password = $this->post('password'); | 186 | $password = $this->post('password'); |
136 | $url = '/passport/register/index'; | 187 | $url = '/passport/register/index'; |
-
Please register or login to post a comment