浏览代码

新增后台3次登录失败后1天以后才可再次尝试
新增Config中多个变量供JS中使用
修复分类管理在使用CRUD一键生成关联模型后的BUG
修复后台管理员selectpage编辑时的BUG

Karson 8 年之前
父节点
当前提交
f2152bee1f

+ 1 - 1
application/admin/controller/Category.php

@@ -23,7 +23,7 @@ class Category extends Backend
     {
         parent::_initialize();
         $this->request->filter(['strip_tags']);
-        $this->model = model('Category');
+        $this->model = model('app\common\model\Category');
 
         $tree = Tree::instance();
         $tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');

+ 1 - 0
application/admin/controller/auth/Admin.php

@@ -257,6 +257,7 @@ class Admin extends Backend
     protected function selectpage()
     {
         $this->dataLimit = 'auth';
+        $this->dataLimitField = 'id';
         return parent::selectpage();
     }
 

+ 15 - 3
application/admin/library/Auth.php

@@ -27,6 +27,14 @@ class Auth extends \fast\Auth
         return Session::get('admin.' . $name);
     }
 
+    /**
+     * 管理员登录
+     * 
+     * @param   string  $username   用户名
+     * @param   string  $password   密码
+     * @param   int     $keeptime   有效时长
+     * @return  boolean
+     */
     public function login($username, $password, $keeptime = 0)
     {
         $admin = Admin::get(['username' => $username]);
@@ -34,6 +42,10 @@ class Auth extends \fast\Auth
         {
             return false;
         }
+        if ($admin->loginfailure >= 3 && time() - $admin->updatetime < 86400)
+        {
+            return false;
+        }
         if ($admin->password != md5(md5($password) . $admin->salt))
         {
             $admin->loginfailure++;
@@ -103,8 +115,9 @@ class Auth extends \fast\Auth
 
     /**
      * 刷新保持登录的Cookie
-     * @param int $keeptime
-     * @return boolean
+     * 
+     * @param   int     $keeptime
+     * @return  boolean
      */
     protected function keeplogin($keeptime = 0)
     {
@@ -167,7 +180,6 @@ class Auth extends \fast\Auth
         //判断是否同一时间同一账号只能在一个地方登录
         if (Config::get('fastadmin.login_unique'))
         {
-            
             $my = Admin::get($admin['id']);
             if (!$my || $my['token'] != $admin['token'])
             {

+ 3 - 2
application/common/controller/Backend.php

@@ -61,7 +61,7 @@ class Backend extends Controller
      * 数据限制字段
      */
     protected $dataLimitField = 'admin_id';
-    
+
     /**
      * 数据限制开启时自动填充限制字段值
      */
@@ -171,7 +171,7 @@ class Backend extends Controller
 
         // 配置信息
         $config = [
-            'site'           => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
+            'site'           => array_intersect_key($site, array_flip(['name', 'indexurl', 'cdnurl', 'version', 'timezone', 'languages'])),
             'upload'         => $upload,
             'modulename'     => $modulename,
             'controllername' => $controllername,
@@ -182,6 +182,7 @@ class Backend extends Controller
             'fastadmin'      => Config::get('fastadmin'),
             'referer'        => Session::get("referer")
         ];
+        $config = array_merge($config, Config::get("view_replace_str"));
 
         Config::set('upload', array_merge(Config::get('upload'), $upload));
 

+ 1 - 0
application/common/controller/Frontend.php

@@ -116,6 +116,7 @@ class Frontend extends Controller
             'moduleurl'      => rtrim(url("/{$modulename}", '', false), '/'),
             'language'       => $lang
         ];
+        $config = array_merge($config, Config::get("view_replace_str"));
 
         Config::set('upload', array_merge(Config::get('upload'), $upload));
 

+ 1 - 1
public/assets/js/backend/auth/rule.js

@@ -111,7 +111,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
                     name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node"));
                 });
                 $("input[name='row[ismenu]']:checked").trigger("click");
-                
+
                 var iconlist = [];
                 Form.api.bindevent($("form[role=form]"));
                 $(document).on('click', ".btn-search-icon", function () {