public function findPwdFour() { $postData = utils::_filter_input(input::get()); $userId = $postData['userid']; $account = $postData['account']; $vcodeData = userVcode::getVcode($account, 'forgot'); $key = userVcode::getVcodeKey($account, 'forgot'); if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) { $msg = app::get('topm')->_('页面已过期,请重新找回密码'); return $this->splash('failed', null, $msg, true); } $data['type'] = 'reset'; $data['new_pwd'] = $postData['password']; $data['user_id'] = $postData['userid']; $data['confirm_pwd'] = $postData['confirmpwd']; try { app::get('topm')->rpcCall('user.pwd.update', $data, 'buyer'); } catch (Exception $e) { $msg = $e->getMessage(); $url = url::action('topm_ctl_passport@findPwd'); return $this->splash('error', $url, $msg, true); } $msg = "修改成功"; $url = url::action('topm_ctl_passport@login'); return $this->splash('success', $url, $msg, true); }
public function findPwdFour() { $postData = utils::_filter_input(input::get()); $userId = $postData['userid']; $account = $postData['account']; $vcodeData = userVcode::getVcode($account, 'forgot'); $key = userVcode::getVcodeKey($account, 'forgot'); if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) { $msg = app::get('topc')->_('页面已过期,请重新找回密码'); return $this->splash('failed', null, $msg, true); } $validator = validator::make(['password' => $postData['password'], 'password_confirmation' => $postData['confirmpwd']], ['password' => 'min:6|max:20|confirmed'], ['password' => '密码长度不能小于6位!|密码长度不能大于20位!|输入的密码不一致!']); if ($validator->fails()) { $messages = $validator->messagesInfo(); foreach ($messages as $error) { throw new LogicException($error[0]); } } $data['type'] = 'reset'; $data['new_pwd'] = $postData['password']; $data['user_id'] = $postData['userid']; $data['confirm_pwd'] = $postData['confirmpwd']; try { app::get('topc')->rpcCall('user.pwd.update', $data, 'buyer'); } catch (Exception $e) { $msg = $e->getMessage(); $url = url::action('topc_ctl_passport@findPwd'); return $this->splash('error', $url, $msg, true); } return view::make('topc/passport/forgot/four.html'); }