public function updateMyInfoAction() { $userid = $this->loginUser->uid; $txt_real_name = $this->getInput("Txt_petname"); $rd_sex = $this->getInput("Rd_sex_1"); $txt_blog = trim($this->getInput("Txt_blog")); $txt_introduce = trim($this->getInput("Txt_introduce")); //Txt_introduce $txt_qq = $this->getInput("Txt_qq"); //Txt_qq $txt_alipay = $this->getInput("Txt_alipay"); //Txt_alipay $byear = $this->getInput("byear"); $bmonth = $this->getInput("bmonth"); $bday = $this->getInput("bday"); $email = trim($this->getInput('Txt_email', 'post')); $userDm = new PwUserInfoDm($this->loginUser->uid); $userDm->setRealname($txt_real_name); $userDm->setByear($byear); $userDm->setBmonth($bmonth); $userDm->setBday($bday); $userDm->setGender($rd_sex); $userDm->setHomepage($txt_blog); $userDm->setProfile($txt_introduce); $userDm->setAliww($txt_alipay); $userDm->setQq($txt_qq); $userDm->setEmail($email); $returnData = array("success" => true, "data" => "更新成功"); if ($email) { $r = PwUserValidator::isEmailValid($email, $this->loginUser->username); if ($r instanceof PwError) { $code = $r->getError(); $message = "邮箱地址已经被占用, 请使用另外一个地址"; if ($code == 'USER:user.error.-7') { $message = "请输入有效的邮箱地址"; } $returnData['success'] = false; $returnData['data'] = $message; print_r(json_encode($returnData)); die; } } //更新成功, 页面将刷新 $userDs = Wekit::load('user.PwUser'); $result = $userDs->editUser($userDm, PwUser::FETCH_MAIN + PwUser::FETCH_INFO); if ($result instanceof PwError) { $code = $result->getError(); if ($code == "USER:error.profile.length") { $message = "您最多输入250个字的自我描述"; } else { if ($code == "USER:error.homepage") { $message = "博客地址不正确,需要以http开头"; } else { $message = "信息填写不完全" . $code; } } $returnData['success'] = false; $returnData['data'] = $message; // "请设置正确的博客链接"; print_r(json_encode($returnData)); die; } print_r(json_encode($returnData)); die; }
/** * 编辑联系方式 */ public function docontactAction() { $userDm = new PwUserInfoDm($this->loginUser->uid); $userDm->setTelphone($this->getInput('telphone', 'post')); $userDm->setAddress($this->getInput('address', 'post')); $userDm->setZipcode($this->getInput('zipcode', 'post')); $userDm->setAliww($this->getInput('aliww', 'post')); $userDm->setQq($this->getInput('qq', 'post')); $userDm->setMsn($this->getInput('msn', 'post')); list($alipay, $mobile, $email) = $this->getInput(array('alipay', 'mobile', 'email'), 'post'); if ($alipay) { $r = PwUserValidator::isAlipayValid($alipay, $this->loginUser->username); if ($r instanceof PwError) { $this->showError($r->getError()); } } if ($mobile) { $r = PwUserValidator::isMobileValid($mobile); if ($r instanceof PwError) { $this->showError($r->getError()); } } if ($email) { $r = PwUserValidator::isEmailValid($email, $this->loginUser->username); if ($r instanceof PwError) { $this->showError($r->getError()); } } $userDm->setEmail($email); $userDm->setMobile($mobile); $userDm->setAlipay($alipay); $result = $this->_editUser($userDm, PwUser::FETCH_MAIN + PwUser::FETCH_INFO); if ($result instanceof PwError) { $this->showError($result->getError()); } else { $this->loginUser->info = array_merge($this->loginUser->info, $userDm->getData()); $this->showMessage('USER:user.edit.contact.success'); } }
/** * 检查邮箱唯一性 */ public function checkemailAction() { list($email, $username) = $this->getInput(array('email', 'username'), 'post'); $result = PwUserValidator::isEmailValid($email, $username); if ($result instanceof PwError) { $this->showError($result->getError()); } $this->showMessage(); }
/** * 密码验证 */ public function doeditemailAction() { list($passwd, $email) = $this->getInput(array('passwd', 'email'), 'post'); if (!$passwd || !$email) { $this->showError('USER:empty.error'); } Wind::import('SRV:user.srv.PwTryPwdBp'); $tryPwdBp = new PwTryPwdBp(); if (($result = $tryPwdBp->checkPassword($this->loginUser->uid, $passwd, $this->getRequest()->getClientIp())) instanceof PwError) { list($error, ) = $result->getError(); if ($error == 'USER:login.error.pwd') { $this->showError($result->getError()); } else { Wind::import('SRC:service.user.srv.PwUserService'); $srv = new PwUserService(); $srv->logout(); $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('profile/index/run'))); } } $userDm = new PwUserInfoDm($this->loginUser->uid); $r = PwUserValidator::isEmailValid($email, $this->loginUser->username); if ($r instanceof PwError) { $this->showError($r->getError()); } $userDm->setEmail($email); $result = $this->_editUser($userDm, PwUser::FETCH_MAIN); if ($result instanceof PwError) { $this->showError($result->getError()); } else { $this->loginUser->info = array_merge($this->loginUser->info, $userDm->getData()); $this->showMessage('USER:user.edit.contact.success', 'profile/index/contact?_tab=contact'); } }