Browse Source

Update UserController.class.php

star7th 5 years ago
parent
commit
f509f20fd6
1 changed files with 11 additions and 0 deletions
  1. 11 0
      server/Application/Api/Controller/UserController.class.php

+ 11 - 0
server/Application/Api/Controller/UserController.class.php

@@ -19,6 +19,11 @@ class UserController extends BaseController {
         session('v_code',null) ;
         if ( $password != '' && $password == $confirm_password) {
 
+            if(!D("User")->checkDbOk()){
+                $this->sendError(100100,"数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用");
+                return;
+            }
+
             if ( ! D("User")->isExist($username) ) {
                 $new_uid = D("User")->register($username,$password);
                 if ($new_uid) {
@@ -62,6 +67,12 @@ class UserController extends BaseController {
             }
         }
         session('v_code',null) ;
+
+        if(!D("User")->checkDbOk()){
+            $this->sendError(100100,"数据库连接不上。请确保安装了php-sqlite扩展以及数据库文件Sqlite/showdoc.db.php可用");
+            return;
+        }
+
         $ret = D("User")->checkLogin($username,$password);
         //如果失败则尝试ldap登录
         if (!$ret) {