* adjust for check password.
This commit is contained in:
@@ -47,14 +47,20 @@ $lang->admin->bind->success = "Bind success";
|
||||
|
||||
$lang->admin->safe = new stdclass();
|
||||
$lang->admin->safe->common = 'Safe';
|
||||
$lang->admin->safe->account = 'Account';
|
||||
$lang->admin->safe->checkPwd = 'Check password';
|
||||
$lang->admin->safe->set = 'Set password safe';
|
||||
$lang->admin->safe->password = 'Password safe';
|
||||
$lang->admin->safe->weak = 'weak Password';
|
||||
$lang->admin->safe->reason = 'Type';
|
||||
$lang->admin->safe->checkWeak = 'Weak password check';
|
||||
$lang->admin->safe->weakUser = 'Weak password account';
|
||||
|
||||
$lang->admin->safe->modeList[0] = 'Do not check';
|
||||
$lang->admin->safe->modeList[1] = 'Intermediate';
|
||||
$lang->admin->safe->modeList[2] = 'Strong';
|
||||
|
||||
$lang->admin->safe->reasonList['weak'] = 'Common weak password';
|
||||
$lang->admin->safe->reasonList['account'] = 'Same account';
|
||||
$lang->admin->safe->reasonList['mobile'] = 'Same mobile';
|
||||
$lang->admin->safe->reasonList['phone'] = 'Same phone';
|
||||
$lang->admin->safe->reasonList['birthday'] = 'Same birthday';
|
||||
|
||||
$lang->admin->safe->noticeMode = 'The system will log in, create and modify the user password, check the user password.';
|
||||
|
||||
@@ -47,14 +47,20 @@ $lang->admin->bind->success = "关联账户成功";
|
||||
|
||||
$lang->admin->safe = new stdclass();
|
||||
$lang->admin->safe->common = '安全';
|
||||
$lang->admin->safe->account = '账号';
|
||||
$lang->admin->safe->checkPwd = '密码检查';
|
||||
$lang->admin->safe->set = '密码安全设置';
|
||||
$lang->admin->safe->password = '密码安全';
|
||||
$lang->admin->safe->weak = '常用弱口令';
|
||||
$lang->admin->safe->checkWeak = '弱口令检查';
|
||||
$lang->admin->safe->weakUser = '弱口令账号';
|
||||
$lang->admin->safe->reason = '类型';
|
||||
$lang->admin->safe->checkWeak = '弱口令扫描';
|
||||
|
||||
$lang->admin->safe->modeList[0] = '不检查';
|
||||
$lang->admin->safe->modeList[1] = '中';
|
||||
$lang->admin->safe->modeList[2] = '强';
|
||||
|
||||
$lang->admin->safe->reasonList['weak'] = '常用弱口令';
|
||||
$lang->admin->safe->reasonList['account'] = '与账号相同';
|
||||
$lang->admin->safe->reasonList['mobile'] = '与手机相同';
|
||||
$lang->admin->safe->reasonList['phone'] = '与电话相同';
|
||||
$lang->admin->safe->reasonList['birthday'] = '与生日相同';
|
||||
|
||||
$lang->admin->safe->noticeMode = '系统会在登录、创建和修改用户、修改密码的时候检查用户口令。';
|
||||
|
||||
@@ -13,16 +13,11 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='featurebar'>
|
||||
<ul class='nav'>
|
||||
<li class='active'><?php echo html::a($this->inlink('safe'), $lang->admin->safe->account);?></li>
|
||||
<li><?php common::printLink('admin', 'safe', '', $lang->admin->safe->set);?></li>
|
||||
<li class='active'><?php common::printLink('admin', 'checkWeak', '', $lang->admin->safe->checkWeak);?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='container mw-800px'>
|
||||
<div id="titlebar">
|
||||
<div class="heading">
|
||||
<strong><?php echo $lang->admin->safe->weakUser?></strong>
|
||||
<?php echo html::a(inlink('safe'), $lang->goback, '', "class=''")?>
|
||||
</div>
|
||||
</div>
|
||||
<table class='table table-condensed table-hover table-striped table-fixed'>
|
||||
<thead>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
@@ -30,18 +25,20 @@
|
||||
<th><?php echo $lang->user->account;?></th>
|
||||
<th><?php echo $lang->user->phone;?></th>
|
||||
<th><?php echo $lang->user->mobile;?></th>
|
||||
<th><?php echo $lang->user->birthday;?></th>
|
||||
<th><?php echo $lang->user->birthyear;?></th>
|
||||
<th><?php echo $lang->admin->safe->reason;?></th>
|
||||
<th class='w-50px'><?php echo $lang->actions;?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class='text-center'>
|
||||
<?php foreach($weakUsers as $user):?>
|
||||
<tr>
|
||||
<td><?php echo $user->id?></td>
|
||||
<td><?php echo $user->realname?></td>
|
||||
<td><?php echo $user->account?></td>
|
||||
<td class='text-right'><?php echo $user->id?></td>
|
||||
<td class='text-left'><?php echo $user->realname?></td>
|
||||
<td class='text-left'><?php echo $user->account?></td>
|
||||
<td><?php echo $user->phone?></td>
|
||||
<td><?php echo $user->mobile?></td>
|
||||
<td><?php echo $user->birthday?></td>
|
||||
<td><?php echo $lang->admin->safe->reasonList[$user->weakReason];?></td>
|
||||
<td><?php common::printIcon('user', 'edit', "userID=$user->id", '', 'list');?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
|
||||
@@ -13,24 +13,25 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='featurebar'>
|
||||
<ul class='nav'>
|
||||
<li class='active'><?php echo html::a($this->inlink('safe'), $lang->admin->safe->account);?></li>
|
||||
<li class='active'><?php common::printLink('admin', 'safe', '', $lang->admin->safe->set);?></li>
|
||||
<li><?php common::printLink('admin', 'checkWeak', '', $lang->admin->safe->checkWeak);?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='container mw-800px'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->admin->safe->checkPwd?></th>
|
||||
<td><?php echo html::select('mode', $lang->admin->safe->modeList, isset($config->safe->mode) ? $config->safe->mode : 0, "class='form-control'")?></td>
|
||||
<th class='w-100px'><?php echo $lang->admin->safe->password?></th>
|
||||
<td><?php echo html::radio('mode', $lang->admin->safe->modeList, isset($config->safe->mode) ? $config->safe->mode : 0)?></td>
|
||||
<td><?php echo $lang->admin->safe->noticeMode?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->admin->safe->weak?></th>
|
||||
<td colspan='2'><?php echo html::input('weak', $config->safe->weak, "class='form-control'")?></td>
|
||||
<td colspan='2'><?php echo html::textarea('weak', $config->safe->weak, "class='form-control' rows='4'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td colspan='2'><?php echo html::submitButton() . html::a(inlink('checkWeak'), $lang->admin->safe->checkWeak, '', "class='btn'");?></td>
|
||||
<td colspan='2'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -284,7 +284,7 @@ $lang->admin->menu->custom = array('link' => 'Custom|custom|index', 'subModul
|
||||
$lang->admin->menu->mail = array('link' => 'Email|mail|index', 'subModule' => 'mail');
|
||||
$lang->admin->menu->convert = array('link' => 'Import|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->backup = array('link' => 'Backup|backup|index', 'subModule' => 'backup');
|
||||
$lang->admin->menu->safe = array('link' => 'Safe|admin|safe',);
|
||||
$lang->admin->menu->safe = array('link' => 'Safe|admin|safe', 'alias' => 'checkweak');
|
||||
$lang->admin->menu->cron = array('link' => 'Cron|cron|index', 'subModule' => 'cron');
|
||||
$lang->admin->menu->trashes = array('link' => 'Trash|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->dev = array('link' => 'Develop|dev|api', 'alias' => 'db', 'subModule' => 'dev,editor');
|
||||
|
||||
@@ -284,7 +284,7 @@ $lang->admin->menu->custom = array('link' => '自定义|custom|index', 'subMo
|
||||
$lang->admin->menu->mail = array('link' => '发信|mail|index', 'subModule' => 'mail');
|
||||
$lang->admin->menu->convert = array('link' => '导入|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->backup = array('link' => '备份|backup|index', 'subModule' => 'backup');
|
||||
$lang->admin->menu->safe = array('link' => '安全|admin|safe',);
|
||||
$lang->admin->menu->safe = array('link' => '安全|admin|safe', 'alias' => 'checkweak');
|
||||
$lang->admin->menu->cron = array('link' => '计划任务|cron|index', 'subModule' => 'cron');
|
||||
$lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->dev = array('link' => '二次开发|dev|api', 'alias' => 'db', 'subModule' => 'dev,editor');
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<td>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' autocomplete='off' onkeyup='checkPwd(this.value)'");?>
|
||||
<span class='input-group-addon' id='pwdLevel'></span>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -46,11 +46,11 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php js::set('pwdLevelList', $lang->user->pwdLevelList)?>
|
||||
<?php js::set('passwordStrengthList', $lang->user->passwordStrengthList)?>
|
||||
<script>
|
||||
function checkPwd(password)
|
||||
{
|
||||
$('#pwdLevel').html(pwdLevelList[pwdLevel(password)]);
|
||||
$('#passwordStrength').html(passwordStrengthList[computePasswordStrength(password)]);
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<td>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' autocomplete='off' onkeyup='checkPwd(this.value)'");?>
|
||||
<span class='input-group-addon' id='pwdLevel'></span>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
<th><?php echo $lang->user->password2;?></th>
|
||||
@@ -110,11 +110,11 @@
|
||||
<div class='text-center'><?php echo html::submitButton('', '', 'btn-primary') . ' ' . html::backButton();?></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('pwdLevelList', $lang->user->pwdLevelList)?>
|
||||
<?php js::set('passwordStrengthList', $lang->user->passwordStrengthList)?>
|
||||
<script>
|
||||
function checkPwd(password)
|
||||
{
|
||||
$('#pwdLevel').html(pwdLevelList[pwdLevel(password)]);
|
||||
$('#passwordStrength').html(passwordStrengthList[computePasswordStrength(password)]);
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -657,7 +657,7 @@ class user extends control
|
||||
if($this->post->keepLogin) $this->user->keepLogin($user);
|
||||
|
||||
/* Check password. */
|
||||
if(isset($this->config->safe->mode) and $this->user->pwdLevel($password) < $this->config->safe->mode) echo js::alert($this->lang->user->weakPwd);
|
||||
if(isset($this->config->safe->mode) and $this->user->computePasswordStrength($password) < $this->config->safe->mode) echo js::alert($this->lang->user->weakPwd);
|
||||
|
||||
/* Go to the referer. */
|
||||
if($this->post->referer and
|
||||
|
||||
@@ -42,5 +42,5 @@ function changeEmail(num)
|
||||
|
||||
function checkPwd(password)
|
||||
{
|
||||
$('#pwdLevel').html(pwdLevelList[pwdLevel(password)]);
|
||||
$('#passwordStrength').html(passwordStrengthList[computePasswordStrength(password)]);
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ $lang->user->roleList['others'] = 'Others';
|
||||
$lang->user->genderList['m'] = 'Male';
|
||||
$lang->user->genderList['f'] = 'Female';
|
||||
|
||||
$lang->user->pwdLevelList[0] = 'Weak';
|
||||
$lang->user->pwdLevelList[1] = 'Intermediate';
|
||||
$lang->user->pwdLevelList[2] = 'Strong';
|
||||
$lang->user->passwordStrengthList[0] = 'Weak';
|
||||
$lang->user->passwordStrengthList[1] = 'Good';
|
||||
$lang->user->passwordStrengthList[2] = 'Strong';
|
||||
|
||||
$lang->user->statusList['active'] = 'Activate';
|
||||
$lang->user->statusList['delete'] = 'Deleted';
|
||||
|
||||
@@ -122,9 +122,9 @@ $lang->user->roleList['others'] = '其他';
|
||||
$lang->user->genderList['m'] = '男';
|
||||
$lang->user->genderList['f'] = '女';
|
||||
|
||||
$lang->user->pwdLevelList[0] = '弱';
|
||||
$lang->user->pwdLevelList[1] = '中';
|
||||
$lang->user->pwdLevelList[2] = '强';
|
||||
$lang->user->passwordStrengthList[0] = '弱';
|
||||
$lang->user->passwordStrengthList[1] = '中';
|
||||
$lang->user->passwordStrengthList[2] = '强';
|
||||
|
||||
$lang->user->statusList['active'] = '正常';
|
||||
$lang->user->statusList['delete'] = '删除';
|
||||
|
||||
+27
-11
@@ -209,7 +209,7 @@ class userModel extends model
|
||||
->remove('group, password1, password2, verifyPwd')
|
||||
->get();
|
||||
|
||||
if(isset($this->config->safe->mode) and $this->pwdLevel($this->post->password1) < $this->config->safe->mode)
|
||||
if(isset($this->config->safe->mode) and $this->computePasswordStrength($this->post->password1) < $this->config->safe->mode)
|
||||
{
|
||||
dao::$errors['password1'][] = $this->lang->user->weakPwd;
|
||||
return false;
|
||||
@@ -322,7 +322,7 @@ class userModel extends model
|
||||
->remove('password1, password2, groups,verifyPwd')
|
||||
->get();
|
||||
|
||||
if(isset($this->config->safe->mode) and $user->password and $this->pwdLevel($this->post->password1) < $this->config->safe->mode)
|
||||
if(isset($this->config->safe->mode) and $user->password and $this->computePasswordStrength($this->post->password1) < $this->config->safe->mode)
|
||||
{
|
||||
dao::$errors['password1'][] = $this->lang->user->weakPwd;
|
||||
return false;
|
||||
@@ -438,7 +438,7 @@ class userModel extends model
|
||||
->remove('account, password1, password2, originalPwd')
|
||||
->get();
|
||||
|
||||
if(isset($this->config->safe->mode) and $this->pwdLevel($this->post->password1) < $this->config->safe->mode)
|
||||
if(isset($this->config->safe->mode) and $this->computePasswordStrength($this->post->password1) < $this->config->safe->mode)
|
||||
{
|
||||
dao::$errors['password1'][] = $this->lang->user->weakPwd;
|
||||
return false;
|
||||
@@ -886,13 +886,29 @@ class userModel extends model
|
||||
$weakUsers = array();
|
||||
foreach($users as $user)
|
||||
{
|
||||
if(isset($weaks[$user->password])
|
||||
or $user->password == md5($user->account)
|
||||
or ($user->phone and $user->password == md5($user->phone))
|
||||
or ($user->mobile and $user->password == md5($user->mobile))
|
||||
or ($user->birthday and $user->password == md5($user->birthday))
|
||||
)
|
||||
if(isset($weaks[$user->password]))
|
||||
{
|
||||
$user->weakReason = 'weak';
|
||||
$weakUsers[] = $user;
|
||||
}
|
||||
elseif($user->password == md5($user->account))
|
||||
{
|
||||
$user->weakReason = 'account';
|
||||
$weakUsers[] = $user;
|
||||
}
|
||||
elseif($user->phone and $user->password == md5($user->phone))
|
||||
{
|
||||
$user->weakReason = 'phone';
|
||||
$weakUsers[] = $user;
|
||||
}
|
||||
elseif($user->mobile and $user->password == md5($user->mobile))
|
||||
{
|
||||
$user->weakReason = 'mobile';
|
||||
$weakUsers[] = $user;
|
||||
}
|
||||
elseif($user->birthday and $user->password == md5($user->birthday))
|
||||
{
|
||||
$user->weakReason = 'birthday';
|
||||
$weakUsers[] = $user;
|
||||
}
|
||||
}
|
||||
@@ -901,13 +917,13 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password level.
|
||||
* Compute password strength.
|
||||
*
|
||||
* @param string $password
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function pwdLevel($password)
|
||||
public function computePasswordStrength($password)
|
||||
{
|
||||
if(strlen($password) == 0) return 0;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<td>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' autocomplete='off' onkeyup='checkPwd(this.value)'");?>
|
||||
<span class='input-group-addon' id='pwdLevel'></span>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -83,5 +83,5 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('pwdLevelList', $lang->user->pwdLevelList)?>
|
||||
<?php js::set('passwordStrengthList', $lang->user->passwordStrengthList)?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<td>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' autocomplete='off' onkeyup='checkPwd(this.value)'");?>
|
||||
<span class='input-group-addon' id='pwdLevel'></span>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
<th><?php echo $lang->user->password2;?></th>
|
||||
@@ -109,5 +109,5 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('pwdLevelList', $lang->user->pwdLevelList)?>
|
||||
<?php js::set('passwordStrengthList', $lang->user->passwordStrengthList)?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
+1
-1
@@ -1262,7 +1262,7 @@ function startCron()
|
||||
$.ajax({type:"GET", timeout:100, url:createLink('cron', 'ajaxExec')});
|
||||
}
|
||||
|
||||
function pwdLevel(password)
|
||||
function computePasswordStrength(password)
|
||||
{
|
||||
if(password.length == 0) return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user