Beispiel #1
0
 public function user_add()
 {
     $req = req()->_plain();
     if ($req->is_post()) {
         lib()->load("UserRegister", "UserCheck");
         try {
             $ur = new UserRegister();
             hook()->add('UserRegister_Captcha', function () {
                 //通过钩子去掉用户注册验证码
                 return true;
             });
             $id = $ur->Register($req->post('email'), UserCheck::MakeHashChar($req->post('password')), $req->post('name'), "ADMIN");
             if ($id > 0) {
                 $this->rt_msg['status'] = true;
                 $this->rt_msg['content'] = $id;
             } else {
                 $this->rt_msg['msg'] = $ur->CodeMsg($id);
             }
         } catch (\Exception $ex) {
             $this->rt_msg['msg'] = $ex->getMessage();
         }
     } else {
         $this->rt_msg['msg'] = "必须以POST方式提交数据";
     }
 }
Beispiel #2
0
 /**
  * 用户根据激活邮件激活
  * @param $code
  */
 public function user_activation($code = NULL)
 {
     if (!is_login()) {
         $this->rt_msg['msg'] = "必须登录才能进行用户激活";
     } else {
         lib()->load("UserRegister");
         try {
             UserRegister::UserActivation(login_user(), $code);
             $this->rt_msg['status'] = true;
         } catch (\Exception $ex) {
             $this->rt_msg['msg'] = $ex->getMessage();
         }
     }
 }