Pre Merge pull request !63 from 清天君/master

pull/769309/MERGE
朴新教育 2018-06-24 23:39:35 +08:00
commit b539a29be2
7 changed files with 23 additions and 5 deletions

View File

@ -25,6 +25,7 @@ return [
'Username or password can not be empty' => '用户名密码不能为空',
'Username or password is incorrect' => '用户名或密码不正确',
'Username is incorrect' => '用户名不正确',
'Username is locked' => '用户名已锁定,请联系管理员',
'Password is incorrect' => '密码不正确',
'Please try again after 1 day' => '请于1天后再尝试登录',
'Login successful' => '登录成功!',

View File

@ -43,6 +43,10 @@ class Auth extends \fast\Auth
$this->setError('Username is incorrect');
return false;
}
if ($admin->status == 'locked') {
$this->setError('Username is locked');
return false;
}
if (Config::get('fastadmin.login_failure_retry') && $admin->loginfailure >= 10 && time() - $admin->updatetime < 86400) {
$this->setError('Please try again after 1 day');
return false;

View File

@ -32,7 +32,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
{:build_radios('row[status]', ['normal'=>__('Normal'), 'locked'=>__('Locked')])}
</div>
</div>
<div class="form-group hidden layer-footer">

View File

@ -38,7 +38,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
{:build_radios('row[status]', ['normal'=>__('Normal'), 'locked'=>__('Locked')], $row['status'])}
</div>
</div>
<div class="form-group hidden layer-footer">

View File

@ -554,14 +554,14 @@ form.form-horizontal .control-label {
float: left;
background: none;
margin-left: 0;
width: 80px;
/*width: 80px;*/
clear: none;
}
#treeview .jstree-leaf {
float: left;
margin-left: 0;
padding-left: 24px;
width: 80px;
/*width: 80px;*/
clear: none;
color: #777;
}

View File

@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
{field: 'imageheight', title: __('Imageheight'), sortable: true},
{field: 'imagetype', title: __('Imagetype'), formatter:Table.api.formatter.search},
{field: 'storage', title: __('Storage'), formatter: Table.api.formatter.search},
{field: 'filesize', title: __('Filesize'), operate: 'BETWEEN', sortable: true},
{field: 'filesize', title: __('Filesize'), operate: 'BETWEEN', sortable: true, formatter: Table.api.formatter.filesize},
{field: 'mimetype', title: __('Mimetype'), formatter:Table.api.formatter.search},
{
field: 'createtime',

View File

@ -458,6 +458,19 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
} else {
return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
}
},
filesize: function (value, row, index) {
if(value == null || value == ''){
return "0 Bytes";
}
var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
var i = 0;
var srcsize = parseFloat(value);
i = Math.floor(Math.log(srcsize) / Math.log(1024));
var size = srcsize / Math.pow(1024,i);
//保留的小数位数
size = size.toFixed(2);
return size + unitArr[i];
},
operate: function (value, row, index) {
var table = this.table;