public function ajaxSendEmailAction() { $email = Request::getPOST('email'); $verify = Request::getPOST('verify'); if (empty($verify)) { $this->renderAjax(1, '请输入图片验证码!'); } if (empty($email)) { $this->renderAjax(1, '请填写邮箱!'); } // 校验验证码 $imgCode = Session::get('check_code'); if (strtolower($verify) != $imgCode) { $this->renderAjax(2, '图片验证码错误!'); } if (!Regex::match($email, RegexVars::EMAIL)) { $this->renderAjax(1, '邮箱格式错误!'); } // 是否存在 $userInfo = UcUserInterface::getByLoginName(array('login_name' => $email)); if (empty($userInfo)) { $this->renderAjax(1, '用户邮箱不存在!'); } $code = UcAuthInterface::sendEmailCode(array('email' => $email, 'repeat_at' => time() + 60)); if (false === $code) { $this->renderAjax(1, '服务器繁忙,请1分钟后重试!'); } $this->renderAjax(0); }
public function ajaxSubmitAction() { $username = Request::getPOST('username'); $password = Request::getPOST('password'); $verify = Request::getPOST('verify'); if (!Regex::match($username, RegexVars::USERNAME)) { $this->renderAjax(1, '用户名格式不正确!'); } // 校验密码格式 if (!Regex::match($password, RegexVars::PASSWORD)) { $this->renderAjax(1, '密码长度为6-20位!'); } // 校验验证码 $code = Session::get('check_code'); if (strtolower($verify) != $code) { $this->renderAjax(1, '验证码错误,请重试!'); } // 过滤用户名 if (false !== strpos(strtolower($username), 'admin')) { $this->renderAjax(1, '用户已经存在!'); } // 校验用户是否存在 $userInfo = UcUserInterface::getByLoginName(array('login_name' => $username)); if (!empty($userInfo)) { $this->renderAjax(1, '用户名已经被占用!'); } // 保存 $data = array('username' => $username, 'password' => $password, 'reg_ip' => Http::getClientIp()); UcUserInterface::save($data); $this->renderAjax(0); }
public static function getUserInfoByResetTicket($resetTicket) { $memcached = MemcachedPool::getMemcached(MemcachedConfig::$SERVER_COMMON); $key = MemcachedKeys::UC_RESET_TICKET_ . $resetTicket; $loginName = $memcached->get($key); if (false === $loginName) { return array(); } $userInfo = UcUserInterface::getByLoginName(array('login_name' => $loginName)); return $userInfo; }
public static function getByLoginName($params) { return UcUserInterface::getByLoginName($params); }