getCurrent() public static method

Get current user object
public static getCurrent ( ) : User
return User
コード例 #1
0
ファイル: Cron.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     $data['user'] = User::getCurrent();
     $data['cronList'] = CronModel::getCronArray();
     Template::setContext($data);
     Template::setView('admin/cron');
 }
コード例 #2
0
ファイル: Updater.php プロジェクト: sendya/shadowsocks-panel
 public function check()
 {
     if (self::$isCheck) {
         return false;
     }
     if (User::getCurrent()->isAdmin()) {
         $current_version = Option::get("version");
         $git_current_version = file_get_contents(DATA_PATH . 'version.lock');
         // 从 update.loacg.com 服务器上获取版本变化
         $response = self::doGet(self::UPDATE_SERVER . self::CHECK, array("Cookie: ver:" . $current_version));
         if ($response != null) {
             $response = json_decode($response, true);
             $data = $response['data'];
             $online_version = $data['version'];
             if ($data['download_url'] != null) {
             }
             $message = "";
             if ($data['message'] != null) {
                 $message = $data['message'];
             }
             self::$isCheck = true;
             if ($current_version != $online_version) {
                 if ($git_current_version == $online_version) {
                     Option::set("version", $git_current_version);
                     return false;
                 }
                 if ($message == "") {
                     $message = "发现新版本 " . $online_version . " , 可以前往Github下载更新(本消息仅管理员可接收到)";
                 }
                 return htmlspecialchars($message);
             }
         }
     }
     return false;
 }
コード例 #3
0
 public function afterRoute(&$className, &$method)
 {
     $user = User::getCurrent();
     $reflection = new ReflectionMethod($className, $method);
     $docComment = $reflection->getDocComment();
     // $this->isJson = $this->isJSON($docComment);
     if (strpos($docComment, '@Authorization') !== false && !$user) {
         $this->black = true;
     }
     $reflection = new ReflectionObject(new $className());
     $docCommentC = $reflection->getDocComment();
     if (strpos($docCommentC, '@Authorization') !== false && !$user) {
         $this->black = true;
     }
     if (strpos($docComment, '@Admin') !== false || strpos($docCommentC, '@Admin') !== false) {
         if ($user && !$user->isAdmin()) {
             $this->data['message'] = '你不是管理员,无法访问此页面';
             $this->black = true;
         }
     }
     if ($this->black) {
         if ($this->isJson) {
             Template::setContext($this->data);
             Filter::preRender();
         } else {
             Message::show($this->data['message'], 'auth/login', 3);
         }
     }
 }
コード例 #4
0
ファイル: Setting.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 详细参数 页面
  */
 public function system()
 {
     $data['user'] = User::getCurrent();
     $data['options'] = Option::getOptions();
     Template::setContext($data);
     Template::setView("admin/system");
 }
コード例 #5
0
ファイル: Message.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     $data['user'] = User::getCurrent();
     $data['lists'] = MessageModel::getPushMessage(-1);
     Template::setContext($data);
     Template::setView('admin/message');
 }
コード例 #6
0
ファイル: Node.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     $data['user'] = User::getCurrent();
     $data['nodes'] = NodeModel::getNodeArray();
     Template::setContext($data);
     Template::setView('admin/node');
 }
コード例 #7
0
ファイル: User.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     $data['user'] = UserModel::getCurrent();
     $data['users'] = UserModel::getUserList();
     $data['planList'] = json_decode(Option::get('custom_plan_name'), true);
     Template::setContext($data);
     Template::setView('admin/user');
 }
コード例 #8
0
ファイル: Home.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     $data['user'] = User::getCurrent();
     $data['flow_num10'] = Stats::dataUsage(0);
     $data['flow_num30'] = Stats::dataUsage(1);
     $data['flow_num100'] = Stats::dataUsage(2);
     $data['flow_max'] = Stats::dataUsage(3);
     $data['userCount'] = Stats::countUser();
     $data['money'] = Stats::countMoney();
     Template::setContext($data);
     Template::setView('admin/index');
 }
コード例 #9
0
ファイル: Node.php プロジェクト: sendya/shadowsocks-panel
 /**
  * get support custom method node.
  * @return Node[]
  */
 public static function getSupportCustomMethodArray()
 {
     $plan = User::getCurrent()->plan;
     $selectSQL = 'SELECT * FROM node WHERE custom_method=1 AND `type` BETWEEN 0 AND ?';
     $type = 0;
     if ($plan == 'VIP') {
         $type = 1;
     }
     $statement = DB::getInstance()->prepare($selectSQL);
     $statement->bindValue(1, $type);
     $statement->execute();
     return $statement->fetchAll(DB::FETCH_CLASS, __CLASS__);
 }
コード例 #10
0
ファイル: Order.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 创建订单
  *
  */
 public function create()
 {
     $user = User::getCurrent();
     $data['custom_plan_name'] = json_decode(Option::get('custom_plan_name'), true);
     $data['custom_transfer_level'] = json_decode(Option::get('custom_transfer_level'), true);
     $plan = strtoupper($_GET['plan']);
     $money = 0;
     switch ($plan) {
         case 'B':
             $money = 12;
             break;
         case 'C':
             $money = 20;
             break;
         case 'D':
             $money = 35;
             break;
         case 'VIP':
             $money = 50;
             break;
         case 'Z':
             $money = 50;
             break;
     }
     /*
     if(count(MOrder::getByUserId($user->uid)) > 0) {
         header("Location: /order/lists");
         exit();
     }
     */
     $order = new MOrder();
     $order->uid = $user->uid;
     $order->createTime = time();
     $order->money = $money;
     $order->plan = $plan;
     $order->status = 0;
     $order->type = 0;
     // 类型: 0 - 购买套餐 1 - 账户金额充值 2 - 购买卡号
     $remark = $order->type == 0 ? "购买套餐 " : $order->type == 1 ? "金额充值 " : "购买卡号 ";
     $remark .= $plan . ', ' . $money . '元';
     $order->remark = $remark;
     $order->save(Model::SAVE_INSERT);
     Template::putContext("order_id", $order->id);
     Template::putContext('transfer', $data['custom_transfer_level'][$plan]);
     Template::putContext('plan', $plan);
     Template::putContext('plan_name', $data['custom_plan_name'][$plan]);
     Template::putContext('money', $money);
     Template::putContext('user', $user);
     Template::setView('panel/order_create');
 }
コード例 #11
0
ファイル: Invite.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 购买邀请码,必要权限检查
  *
  * @JSON
  * @Authorization
  * @return array
  */
 public function buy()
 {
     $user = User::getUserByUserId(User::getCurrent()->uid);
     $result = array('error' => 1, 'message' => '购买失败,至少需要20GB流量才能购买邀请码。');
     $transfer = Utils::GB * 10;
     // update by github.com/BorLee
     // 1abd9e6be7bfd7e3b1e9f34acd357fa7fa29923c
     if ($user->transfer > $transfer * 2 && $user->transfer - $user->getUseTransfer() > $transfer) {
         $user->transfer = $user->transfer - $transfer;
         $user->invite_num = $user->invite_num + 1;
         $user->save();
         $result = array('error' => 0, 'message' => '购买成功,扣除手续费10GB流量', 'invite_num' => $user->invite_num);
     }
     return $result;
 }
コード例 #12
0
ファイル: Invite.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 添加一个邀请码
  * @JSON
  */
 public function update()
 {
     $result = array('error' => -1, 'message' => 'Request failed');
     $user = User::getCurrent();
     if ($_POST['invite'] == null) {
         $result = array('error' => 0, 'message' => '添加成功,刷新可见');
         $plan = 'A';
         $add_uid = -1;
         $inviteNumber = 1;
         if ($_POST['plan'] != null) {
             $plan = $_POST['plan'];
         }
         if ($_POST['add_uid'] != null) {
             $add_uid = trim($_POST['add_uid']);
             if ($add_uid != $user->uid && $add_uid != -1) {
                 if (!User::getUserByUserId($add_uid)) {
                     $result['error'] = 1;
                     $result['message'] = "此UID: " . $add_uid . " 的用户不存在,添加失败";
                     return $result;
                 }
             }
         }
         if ($_POST['number'] != null) {
             $inviteNumber = $_POST['number'];
         }
         if ($inviteNumber > 1) {
             for ($i = 0; $i < $inviteNumber; $i++) {
                 InviteModel::addInvite($add_uid, $plan);
             }
         } else {
             InviteModel::addInvite($add_uid, $plan);
         }
         $result['inviteNumber'] = $inviteNumber;
         $result['plan'] = $plan;
     } else {
         if ($_POST['invite'] != null) {
             $invite = InviteModel::getInviteByInviteCode(trim($_POST['invite']));
             if ($invite != null) {
                 $invite->dateLine = time();
                 $invite->expiration = $_POST['expiration'];
                 $invite->plan = $_POST['plan'];
                 $invite->save();
                 $result = array('error' => 0, 'message' => '更新邀请码成功');
             }
         }
     }
     return $result;
 }
コード例 #13
0
ファイル: Node.php プロジェクト: sendya/shadowsocks-panel
 /**
  * @JSON
  * @return array
  */
 public function getNodeInfo()
 {
     $id = trim($_REQUEST['id']);
     $result = array('error' => -1, 'message' => 'Request failed');
     $user = User::getUserByUserId(User::getCurrent()->uid);
     $node = MNode::getNodeById($id);
     $method = $node->method;
     if ($node->custom_method == 1 && $user->method != '' && $user->method != null) {
         $method = $user->method;
     }
     $info = self::nodeDetail($node->server, $user->port, $user->sspwd, $method, $node->name);
     if (self::verifyPlan($user->plan, $node->type)) {
         $result = array('error' => 0, 'message' => '获取成功', 'info' => $info, 'node' => $node);
     } else {
         $result = array('error' => -1, 'message' => '你不是 VIP, 无法使用高级节点!');
     }
     return $result;
 }
コード例 #14
0
ファイル: Mailer.php プロジェクト: sendya/shadowsocks-panel
 /**
  * @JSON
  */
 public function test()
 {
     $result = array('error' => 1, 'message' => '发送邮件错误,请检查邮件配置');
     $user = User::getCurrent();
     $mailer = Mailer1::getInstance();
     $mail = new Mail();
     $mail->to = $user->email;
     $mail->subject = '[' . SITE_NAME . '] 这是一封测试邮件';
     $mail->content = '这是一封<b>单条发送</b>测试邮件';
     $mail->content .= "<p style=\"padding: 1.5em 1em 0; color: #999; font-size: 12px;\">—— 本邮件由 " . SITE_NAME . " (<a href=\"" . BASE_URL . "\">" . BASE_URL . "</a>) 管理员发送</p>";
     if (!$mailer->send($mail)) {
         return $result;
     }
     $mailer->toQueue(true);
     $mail->subject = '[' . SITE_NAME . '] 这是一封多条发送测试邮件';
     $mail->content = '这是一封<b>多条发送</b>测试邮件';
     $mail->content .= "<p style=\"padding: 1.5em 1em 0; color: #999; font-size: 12px;\">—— 本邮件由 " . SITE_NAME . " (<a href=\"" . BASE_URL . "\">" . BASE_URL . "</a>) 管理员发送</p>";
     if (!$mailer->send($mail)) {
         return $result;
     } else {
         $result = array('error' => 0, 'message' => '邮件已经发送到您的邮箱上');
         return $result;
     }
 }
コード例 #15
0
ファイル: Member.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 删除自己的账户(在本站彻底清空自己注册的账户)
  *
  * @JSON
  * @return array
  */
 public function deleteMe()
 {
     $user = User::getCurrent();
     $flag = $_POST['delete'];
     $result = array('error' => 1, "message" => "请求错误");
     if ($flag != null && $flag == '1') {
         $user->delete();
         $result = array("error" => 0, "message" => "您已经从本站消除所有记忆,将在 3秒 后执行世界初始化...<br/>祝您过得愉快。");
         $_SESSION['currentUser'] = null;
         setcookie("uid", '', time() - 3600, "/");
         setcookie("expire", '', time() - 3600, "/");
         setcookie("token", '', time() - 3600, "/");
     }
     return $result;
 }
コード例 #16
0
ファイル: Ticket.php プロジェクト: sendya/shadowsocks-panel
 public function index()
 {
     Template::putContext('user', User::getCurrent());
     Template::setView('panel/ticket');
 }
コード例 #17
0
ファイル: Card.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 修改 和 新增 卡号
  *
  * @JSON
  */
 public function update()
 {
     $result = array('error' => 1, 'message' => '请求错误');
     $user = User::getCurrent();
     if ($_POST['card_no'] != null && $_POST['card'] != null) {
         // 修改
         $cardId = intval(trim($_POST['card']));
         $card = MCard::queryCardById($cardId);
         if (!$card) {
             return $result;
         }
         $card->type = intval(trim($_POST['card_type']));
         $card->info = htmlspecialchars(trim($_POST['card_info']));
         $card->status = intval(trim($_POST['card_status']));
         $card->expireTime = intval(trim($_POST['card_exp']));
         $card->save();
         $card->add_time = date("Y-m-d H:i:s", $card->add_time);
         if ($card->type == 0) {
             $card->type = "套餐卡";
         } elseif ($card->type == 1) {
             $card->type = "流量卡";
         } elseif ($card->type == 2) {
             $card->type = "试用延期卡";
         } elseif ($card->type == 3) {
             $card->type = "余额卡";
         }
         $card->status = $card->status == 1 ? "未用" : "已用";
         $result['error'] = 0;
         $result['message'] = "修改卡号成功。";
         $result['card'] = $card;
         return $result;
     } else {
         // 新增
         $number = 1;
         if ($_POST['card_num'] != null) {
             $number = intval(trim($_POST['card_num']));
         }
         $cardList = array();
         for ($i = 0; $i < $number; ++$i) {
             $cardStr = substr(hash("sha256", $user->uid . Utils::randomChar(10)) . time(), 1, 26);
             $card = new MCard();
             $card->add_time = time();
             $card->card = $cardStr;
             $card->type = intval(trim($_POST['card_type']));
             $card->info = htmlspecialchars(trim($_POST['card_info']));
             $card->expireTime = intval(trim($_POST['card_exp']));
             $card->status = 1;
             $card->save();
             $card->add_time = date("Y-m-d H:i:s", $card->add_time);
             if ($card->type == 0) {
                 $card->type = "套餐卡";
             } elseif ($card->type == 1) {
                 $card->type = "流量卡";
             } elseif ($card->type == 2) {
                 $card->type = "试用延期卡";
             } elseif ($card->type == 3) {
                 $card->type = "余额卡";
             }
             $card->status = $card->status == 1 ? "未用" : "已用";
             $cardList[] = $card;
         }
         $result['error'] = 0;
         $result['message'] = "新增卡号成功,共 {$number} 个。";
         $result['card'] = $cardList;
         return $result;
     }
 }
コード例 #18
0
ファイル: User.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 重新检查账户 启用/停用 状态
  * 如果符合启用状态,则将账户调整为 启用
  *
  * @JSON
  */
 public function checkEnable()
 {
     $user = MUser::getCurrent();
     if ($user->getUseTransfer() < $user->transfer && $user->expireTime > time()) {
         $user->enable = 1;
     } else {
         $user->enable = 0;
     }
     if ($user->isAdmin()) {
         $user->enable = 1;
     }
     $user->save();
     return array('enable' => $user->enable, 'message' => '状态检测完毕');
 }
コード例 #19
0
ファイル: Card.php プロジェクト: sendya/shadowsocks-panel
 /**
  * 激活(使用)卡号
  * @JSON
  */
 public function activation()
 {
     $user = User::getUserByUserId(User::getCurrent()->uid);
     $result = array('error' => 1, 'message' => '该卡已经被使用或不存在。');
     if ($_POST['actCard'] != null) {
         $actCard = htmlspecialchars(trim($_POST['actCard']));
         $card = Mcard::queryCard($actCard);
         if (!$card || !$card->status) {
             return $result;
         }
         $custom_transfer_level = json_decode(Option::get('custom_transfer_level'), true);
         $custom_transfer_repeat = json_decode(Option::get('custom_transfer_repeat'), true);
         /* 0-套餐卡 1-流量卡 2-测试卡 3-余额卡 */
         if ($card->type == 0) {
             if ($user->plan == 'Z' && $user->transfer > $user->flow_up + $user->flow_down) {
                 $result['message'] = '您的流量套餐尚未使用完毕。无法转换到 ' . Utils::planAutoShow($card->info) . ' 套餐';
                 return $result;
             }
             //判断账户卡号类型是否一致 一致则无视系统叠加开关进行 叠加时间
             $user->payTime = time();
             if ($user->flow_up + $user->flow_down < $user->transfer) {
                 $user->enable = 1;
             } else {
                 $user->enable = 0;
             }
             $cardDay = 31;
             if (is_numeric($card->expireTime)) {
                 $cardDay = intval($card->expireTime);
             }
             $expireTime = 0;
             if ($user->plan == $card->info) {
                 // 卡片与账户类型相等
                 if ($user->expireTime > time()) {
                     $expireTime = $user->expireTime + 3600 * 24 * $cardDay;
                     // 到期时间 = 当前账户到期时间+卡片时间
                 } else {
                     $expireTime = time() + 3600 * 24 * $cardDay;
                     // 到期时间 = 当前系统续费时间+卡片时间
                 }
             } else {
                 if ($user->expireTime < time() || !$custom_transfer_repeat) {
                     $expireTime = time() + 3600 * 24 * $cardDay;
                     // 到期时间 = 不叠加原时间 (当前系统续费时间+卡片时间)
                 } else {
                     $expireTime = $user->expireTime + 3600 * 24 * $cardDay;
                     // 到期时间 = 当前账户到期时间+卡片时间
                 }
             }
             $user->expireTime = $expireTime;
             $user->plan = $card->info;
             $user->transfer = Utils::GB * intval($custom_transfer_level[$user->plan]);
             $result['message'] = '您的账户已升级到 ' . Utils::planAutoShow($user->plan) . ' ,共有流量 ' . Utils::flowAutoShow($user->transfer) . ', 已用 ' . Utils::flowAutoShow($user->flow_down + $user->flow_up) . ', 到期时间:' . date('Y-m-d H:i:s', $user->expireTime);
         } elseif ($card->type == 1) {
             if ($user->plan == 'Z') {
                 $user->transfer += intval($card->info) * Utils::GB;
                 // 如果之前是 流量 套餐,则递增
             } else {
                 $user->transfer = intval($card->info) * Utils::GB;
                 // 如果之前是 普通套餐,则清空总流量并设定新流量
                 $user->flow_up = 0;
                 $user->flow_down = 0;
             }
             if ($user->flow_up + $user->flow_down < $user->transfer) {
                 $user->enable = 1;
             } else {
                 $user->enable = 0;
             }
             $user->plan = 'Z';
             // 强制设定为Z
             $user->expireTime = strtotime("+1 year");
             // 账户可用时间增加一年
             $result['message'] = '您的账户已经激活固定流量套餐,共有流量' . Utils::flowAutoShow($user->transfer) . ' ,该流量到期时间 ' . date('Y-m-d H:i:s', $user->expireTime) . ', 感谢您的使用(注意:流量使用完毕前无法通过套餐卡转换为套餐包月用户)';
         } elseif ($card->type == 2) {
             $user_test_day = Option::get('user_test_day') ?: 7;
             if ($user->plan != 'A') {
                 return array('error' => 1, 'message' => '喂喂,你不是测试账户诶? 没办法帮你续命。');
             }
             $user->plan = 'A';
             $user->payTime = time();
             if ($user->expireTime < time()) {
                 $user->expireTime = time() + 3600 * 24 * intval($user_test_day);
                 // 到期时间
             } else {
                 $user->expireTime = $user->expireTime + 3600 * 24 * intval($user_test_day);
                 // 到期时间
             }
             $user->transfer = Utils::GB * intval($custom_transfer_level[$user->plan]);
             $user->flow_down = 0;
             $user->flow_up = 0;
             $user->enable = 1;
             $result['message'] = '您的账户已经激活测试套餐,共有流量' . Utils::flowAutoShow($user->transfer) . ' ,到期时间 ' . date('Y-m-d H:i:s', $user->expireTime) . ', 感谢您的使用';
         } elseif ($card->type == 3) {
             // 余额卡
             $user->money += intval($card->info);
             $user->save();
             $result['message'] = '余额充值成功,您当前余额为 ' . $user->money . ' 元';
         }
         $card->destroy();
         // 将此卡片禁止
         $user->save();
         $_SESSION['currentUser'] = $user;
         // 将用户信息更新到 session 中.
     }
     return $result;
 }
コード例 #20
0
ファイル: Auth.php プロジェクト: sendya/shadowsocks-panel
 /**
  * @JSON
  * @throws \Core\Error
  */
 public function forgePwd()
 {
     $result = array('error' => 1, 'message' => '请求找回密码失败,请刷新页面重试。');
     $siteName = SITE_NAME;
     if (isset($_POST['email']) && $_POST['email'] != '') {
         $user = User::getUserByEmail(htmlspecialchars(trim($_POST['email'])));
         if (!$user) {
             return $result;
         }
         if ($user->enable == 0) {
             $verify_code = json_decode($user->forgePwdCode, true)['verification'];
             if ($verify_code != null) {
                 $result['message'] = '您的账户还未进行邮箱校验,请校验完毕后再试!';
                 return $result;
             }
         }
         $user->lastFindPasswdTime = time();
         if ($user->lastFindPasswdCount != 0 && $user->lastFindPasswdCount > 2) {
             $result['message'] = '找回密码重试次数已达上限!';
             return $result;
         }
         $code = Utils::randomChar(10);
         $forgePwdCode['code'] = $code;
         $forgePwdCode['time'] = time();
         $user->forgePwdCode = json_encode($forgePwdCode);
         $content = Option::get('custom_mail_forgePassword_content');
         $params = ['code' => $code, 'nickname' => $user->nickname, 'email' => $user->email, 'useTraffic' => Utils::flowAutoShow($user->flow_up + $user->flow_down), 'transfer' => Utils::flowAutoShow($user->transfer), 'expireTime' => date('Y-m-d H:i:s', $user->expireTime)];
         $content = Utils::placeholderReplace($content, $params);
         $mailer = Mailer::getInstance();
         $mail = new \Model\Mail();
         $mail->to = $user->email;
         $mail->subject = "[" . SITE_NAME . "] Password Recovery";
         $mail->content = $content;
         $mailer->toQueue(true);
         // 添加到邮件列队
         $isOk = $mailer->send($mail);
         $user->save();
         $result['uid'] = $user->uid;
         if ($isOk) {
             $result['message'] = '验证代码已经发送到该注册邮件地址,请注意查收!<br/>请勿关闭本页面,您还需要验证码来验证您的账户所有权才可重置密码!!';
             $result['error'] = 0;
         } else {
             $result['message'] = '邮件发送失败, 请联系管理员检查邮件系统设置!';
             $result['error'] = 1;
         }
         return $result;
     } else {
         if ($_POST['code'] != '' && $_POST['uid'] != '') {
             $uid = $_POST['uid'];
             $code = trim($_POST['code']);
             $user = User::GetUserByUserId(trim($uid));
             $forgePwdCode = json_decode($user->forgePwdCode, true);
             // forgePwdCode.length > 1 且 验证码一样 且 时间不超过600秒(10分钟)
             if (count($forgePwdCode) > 1 && $forgePwdCode['code'] == $code && time() - intval($forgePwdCode['time']) < 600) {
                 $newPassword = Utils::randomChar(10);
                 $user->setPassword($newPassword);
                 $user->lastFindPasswdCount = 0;
                 $user->lastFindPasswdTime = 0;
                 $user->save();
                 $content = Option::get('custom_mail_forgePassword_content_2');
                 $params = ['code' => $code, 'newPassword' => $newPassword, 'nickname' => $user->nickname, 'email' => $user->email, 'useTraffic' => Utils::flowAutoShow($user->flow_up + $user->flow_down), 'transfer' => Utils::flowAutoShow($user->transfer), 'expireTime' => date('Y-m-d H:i:s', $user->expireTime)];
                 $content = Utils::placeholderReplace($content, $params);
                 $mailer = Mailer::getInstance();
                 $mail = new \Model\Mail();
                 $mail->to = $user->email;
                 $mail->subject = "[" . SITE_NAME . "] Your new Password";
                 $mail->content = $content;
                 $mailer->toQueue(true);
                 // 添加到邮件列队
                 $isOk = $mailer->send($mail);
                 if ($isOk) {
                     $result['message'] = '新密码已经发送到该账户邮件地址,请注意查收!<br/> 并且请在登录后修改密码!';
                     $result['error'] = 0;
                 } else {
                     $result['message'] = '邮件发送失败, 请联系管理员检查邮件系统设置!';
                     $result['error'] = 1;
                 }
             } else {
                 $result['message'] = '验证码已经超时或者 验证码填写不正确。请再次确认';
                 $result['error'] = -1;
             }
             return $result;
         } else {
             Template::putContext('user', User::getCurrent());
             Template::setView('panel/forgePwd');
         }
     }
     return $result;
 }