mirror of https://gitee.com/karson/fastadmin.git
新增后台3次登录失败后1天以后才可再次尝试
新增Config中多个变量供JS中使用 修复分类管理在使用CRUD一键生成关联模型后的BUG 修复后台管理员selectpage编辑时的BUGpull/629178/MERGE
parent
a85676435a
commit
f2152bee1f
|
|
@ -23,7 +23,7 @@ class Category extends Backend
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
$this->request->filter(['strip_tags']);
|
$this->request->filter(['strip_tags']);
|
||||||
$this->model = model('Category');
|
$this->model = model('app\common\model\Category');
|
||||||
|
|
||||||
$tree = Tree::instance();
|
$tree = Tree::instance();
|
||||||
$tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');
|
$tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,7 @@ class Admin extends Backend
|
||||||
protected function selectpage()
|
protected function selectpage()
|
||||||
{
|
{
|
||||||
$this->dataLimit = 'auth';
|
$this->dataLimit = 'auth';
|
||||||
|
$this->dataLimitField = 'id';
|
||||||
return parent::selectpage();
|
return parent::selectpage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@ class Auth extends \fast\Auth
|
||||||
return Session::get('admin.' . $name);
|
return Session::get('admin.' . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员登录
|
||||||
|
*
|
||||||
|
* @param string $username 用户名
|
||||||
|
* @param string $password 密码
|
||||||
|
* @param int $keeptime 有效时长
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function login($username, $password, $keeptime = 0)
|
public function login($username, $password, $keeptime = 0)
|
||||||
{
|
{
|
||||||
$admin = Admin::get(['username' => $username]);
|
$admin = Admin::get(['username' => $username]);
|
||||||
|
|
@ -34,6 +42,10 @@ class Auth extends \fast\Auth
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($admin->loginfailure >= 3 && time() - $admin->updatetime < 86400)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($admin->password != md5(md5($password) . $admin->salt))
|
if ($admin->password != md5(md5($password) . $admin->salt))
|
||||||
{
|
{
|
||||||
$admin->loginfailure++;
|
$admin->loginfailure++;
|
||||||
|
|
@ -103,8 +115,9 @@ class Auth extends \fast\Auth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新保持登录的Cookie
|
* 刷新保持登录的Cookie
|
||||||
* @param int $keeptime
|
*
|
||||||
* @return boolean
|
* @param int $keeptime
|
||||||
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
protected function keeplogin($keeptime = 0)
|
protected function keeplogin($keeptime = 0)
|
||||||
{
|
{
|
||||||
|
|
@ -167,7 +180,6 @@ class Auth extends \fast\Auth
|
||||||
//判断是否同一时间同一账号只能在一个地方登录
|
//判断是否同一时间同一账号只能在一个地方登录
|
||||||
if (Config::get('fastadmin.login_unique'))
|
if (Config::get('fastadmin.login_unique'))
|
||||||
{
|
{
|
||||||
|
|
||||||
$my = Admin::get($admin['id']);
|
$my = Admin::get($admin['id']);
|
||||||
if (!$my || $my['token'] != $admin['token'])
|
if (!$my || $my['token'] != $admin['token'])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class Backend extends Controller
|
||||||
* 数据限制字段
|
* 数据限制字段
|
||||||
*/
|
*/
|
||||||
protected $dataLimitField = 'admin_id';
|
protected $dataLimitField = 'admin_id';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据限制开启时自动填充限制字段值
|
* 数据限制开启时自动填充限制字段值
|
||||||
*/
|
*/
|
||||||
|
|
@ -171,7 +171,7 @@ class Backend extends Controller
|
||||||
|
|
||||||
// 配置信息
|
// 配置信息
|
||||||
$config = [
|
$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,
|
'upload' => $upload,
|
||||||
'modulename' => $modulename,
|
'modulename' => $modulename,
|
||||||
'controllername' => $controllername,
|
'controllername' => $controllername,
|
||||||
|
|
@ -182,6 +182,7 @@ class Backend extends Controller
|
||||||
'fastadmin' => Config::get('fastadmin'),
|
'fastadmin' => Config::get('fastadmin'),
|
||||||
'referer' => Session::get("referer")
|
'referer' => Session::get("referer")
|
||||||
];
|
];
|
||||||
|
$config = array_merge($config, Config::get("view_replace_str"));
|
||||||
|
|
||||||
Config::set('upload', array_merge(Config::get('upload'), $upload));
|
Config::set('upload', array_merge(Config::get('upload'), $upload));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ class Frontend extends Controller
|
||||||
'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'),
|
'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'),
|
||||||
'language' => $lang
|
'language' => $lang
|
||||||
];
|
];
|
||||||
|
$config = array_merge($config, Config::get("view_replace_str"));
|
||||||
|
|
||||||
Config::set('upload', array_merge(Config::get('upload'), $upload));
|
Config::set('upload', array_merge(Config::get('upload'), $upload));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"));
|
name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node"));
|
||||||
});
|
});
|
||||||
$("input[name='row[ismenu]']:checked").trigger("click");
|
$("input[name='row[ismenu]']:checked").trigger("click");
|
||||||
|
|
||||||
var iconlist = [];
|
var iconlist = [];
|
||||||
Form.api.bindevent($("form[role=form]"));
|
Form.api.bindevent($("form[role=form]"));
|
||||||
$(document).on('click', ".btn-search-icon", function () {
|
$(document).on('click', ".btn-search-icon", function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue