Merge branch 'sprint/224_liumengyi_63694' into 'master'
* Finish task #63694. See merge request easycorp/zentaopms!4868
This commit is contained in:
@@ -1240,9 +1240,9 @@ EOF;
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->user->updatePassword($this->app->user->id);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
if(isonlybody()) return print(js::closeModal('parent.parent', 'this'));
|
||||
return print(js::locate($this->createLink('my', 'index'), 'parent.parent'));
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess,locate => $this->createLink('my', 'index')));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->changePassword;
|
||||
|
||||
1
module/my/css/changepassword.css
Normal file
1
module/my/css/changepassword.css
Normal file
@@ -0,0 +1 @@
|
||||
#mainContent table > tbody > tr > td > div.text-danger.help-text {word-break: break-all;}
|
||||
@@ -14,6 +14,7 @@ $(document).ready(function()
|
||||
var password1 = $('input#password1').val().trim();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
var rand = $('input#verifyRand').val();
|
||||
if(!password1Encrypted) $("#passwordLength").val(password1.length);
|
||||
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
@@ -13,6 +13,7 @@ $(document).ready(function()
|
||||
var password = $('input#verifyPassword').val();
|
||||
var password1 = $('input#password1').val();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
if(!password1Encrypted) $("#passwordLength").val(password1.length);
|
||||
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class='main-header'>
|
||||
<h2><i class='icon-key'></i> <?php echo $lang->my->changePassword;?></h2>
|
||||
</div>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<form method='post' class='form-ajax'>
|
||||
<table align='center' class='table table-form w-320px'>
|
||||
<tr>
|
||||
<th class='rowhead thWidth'><?php echo $lang->user->account;?></th>
|
||||
@@ -35,7 +35,7 @@
|
||||
<th><?php echo $lang->user->newPassword;?></th>
|
||||
<td>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)' placeholder='" . (!empty($config->safe->mode) ? $lang->user->placeholder->passwordStrength[$config->safe->mode] : '') . "'");?>
|
||||
<?php echo html::password('password1', '', "class='form-control' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)' placeholder='" . zget($lang->user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
@@ -45,7 +45,10 @@
|
||||
<td><?php echo html::password('password2', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center form-actions'><?php echo html::submitButton();?></td>
|
||||
<td colspan='2' class='text-center form-actions'>
|
||||
<?php echo html::hidden('passwordLength', 0);?>
|
||||
<?php echo html::submitButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if(!empty($this->app->user->modifyPasswordReason)):?>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo html::select('visions[]', $this->user->getVisionList(), $user->visions, "class='form-control chosen' multiple");?>
|
||||
<div class='text-center form-actions'><?php echo html::submitButton() . html::backButton();?></div>
|
||||
<div class='text-center form-actions'><?php echo html::hidden('passwordLength', 0) . html::submitButton() . html::backButton();?></div>
|
||||
</form>
|
||||
<?php echo html::hidden('verifyRand', $rand);?>
|
||||
</div>
|
||||
|
||||
@@ -1068,15 +1068,14 @@ class user extends control
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
if($needCreateFile) return print(js::reload('parent'));
|
||||
if($needCreateFile) return $this->send(array('result' => 'success', 'locate' => 'reload'));
|
||||
|
||||
$result = $this->user->resetPassword();
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
if(!$result) return print(js::alert($this->lang->user->resetFail));
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(!$result) return $this->send(array('result' => 'fail', 'message' => $this->lang->user->resetFail));
|
||||
|
||||
echo js::alert($this->lang->user->resetSuccess);
|
||||
$referer = helper::safe64Encode($this->createLink('index', 'index'));
|
||||
return print(js::locate(inlink('logout', 'referer=' . $referer), 'parent'));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->user->resetSuccess, 'locate' => $this->createLink('user', 'logout', 'referer=' . $referer)));
|
||||
}
|
||||
|
||||
/* Remove the real path for security reason. */
|
||||
@@ -1174,6 +1173,7 @@ class user extends control
|
||||
$this->view->title = $this->lang->user->resetPWD;
|
||||
$this->view->expired = $expired;
|
||||
$this->view->user = empty($user) ? '' : $user;
|
||||
$this->view->rand = $this->user->updateSessionRandom();
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
.w-enVerifyPassword {width: 150px !important;}
|
||||
.c-id {width: 70px;}
|
||||
.c-hours {width: 110px;}
|
||||
|
||||
#mainContent table > tbody > tr > td > div.text-danger.help-text {word-break: break-all;}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
.alert-info > h5 > span {color: red;}
|
||||
.btn-back {margin-left: 25px;}
|
||||
.table tbody > tr > td div.text-danger.help-text {word-break: break-all;}
|
||||
|
||||
@@ -13,3 +13,4 @@ body {background: #1183fb linear-gradient(-90deg, #0a48d1 0%, #1183fb 100%); bac
|
||||
#resetPanel .form-group .input-group.required:after {top: 6px;}
|
||||
#resetPanel .form-actions > .btn-wide {min-width: 45%;}
|
||||
#resetPanel .form-actions > a.btn-wide {margin-right: 0px;}
|
||||
#resetForm .form-group div.text-danger.help-text {word-break: break-all;}
|
||||
|
||||
@@ -92,11 +92,12 @@ $(function()
|
||||
$('#password2').change(function(){password2Encrypted = false});
|
||||
$('#submit').click(function()
|
||||
{
|
||||
if(!password1Encrypted && !password2Encrypted)
|
||||
if(!password1Encrypted || !password2Encrypted)
|
||||
{
|
||||
var password1 = $('#password1').val();
|
||||
var password2 = $('#password2').val();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
if(!password1Encrypted) $("#passwordLength").val(password1.length);
|
||||
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
@@ -6,11 +6,12 @@ $(function()
|
||||
$('#password2').change(function(){password2Encrypted = false});
|
||||
$('#submit').click(function()
|
||||
{
|
||||
if(!password1Encrypted && !password2Encrypted)
|
||||
if(!password1Encrypted || !password2Encrypted)
|
||||
{
|
||||
var password1 = $('#password1').val().trim();
|
||||
var password2 = $('#password2').val().trim();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
if(!password1Encrypted) $("#passwordLength").val(password1.length);
|
||||
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
var password1Encrypted = false
|
||||
var password2Encrypted = false
|
||||
$('#password1').change(function(){password1Encrypted = false});
|
||||
$('#password2').change(function(){password2Encrypted = false});
|
||||
$('form #submit').click(function()
|
||||
{
|
||||
var password = $('#password1').val().trim();
|
||||
var passwordStrength = computePasswordStrength(password);
|
||||
if(!password1Encrypted || !password2Encrypted)
|
||||
{
|
||||
var password1 = $('#password1').val().trim();
|
||||
var password2 = $('#password2').val().trim();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
|
||||
$('form').prepend("<input type='hidden' name='passwordStrength' value=" + passwordStrength + "/>");
|
||||
});
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
var rand = $('input#verifyRand').val();
|
||||
if(password1 && !password1Encrypted) $('#password1').val(md5(password1) + rand);
|
||||
if(password2 && !password2Encrypted) $('#password2').val(md5(password2) + rand);
|
||||
password1Encrypted = true;
|
||||
password2Encrypted = true;
|
||||
$('form').prepend("<input type='hidden' name='passwordStrength' value='" + passwordStrength + "'>");
|
||||
$('form').prepend("<input type='hidden' name='passwordLength' value='" + password1.length + "'>");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -10,13 +10,27 @@ $(function()
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
$('#password1').attr('id', 'password');
|
||||
|
||||
var password1Encrypted = false
|
||||
var password2Encrypted = false
|
||||
$('#password1').change(function(){password1Encrypted = false});
|
||||
$('#password2').change(function(){password2Encrypted = false});
|
||||
$('#submit').click(function()
|
||||
{
|
||||
var password1 = $('#password').val();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
if(!password1Encrypted || !password2Encrypted)
|
||||
{
|
||||
var password1 = $('#password1').val().trim();
|
||||
var password2 = $('#password2').val().trim();
|
||||
var passwordStrength = computePasswordStrength(password1);
|
||||
if(!password1Encrypted) $("#passwordLength").val(password1.length);
|
||||
|
||||
$("form input[id=passwordStrength]").val(passwordStrength);
|
||||
if($("form input[name=passwordStrength]").length == 0) $('#submit').after("<input type='hidden' name='passwordStrength' value='0' />");
|
||||
$("form input[name=passwordStrength]").val(passwordStrength);
|
||||
|
||||
var rand = $('input#verifyRand').val();
|
||||
if(password1 && !password1Encrypted) $('#password1').val(md5(password1) + rand);
|
||||
if(password2 && !password2Encrypted) $('#password2').val(md5(password2) + rand);
|
||||
password1Encrypted = true;
|
||||
password2Encrypted = true;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -224,9 +224,14 @@ $lang->user->placeholder->loginAccount = 'Enter your account';
|
||||
$lang->user->placeholder->loginUrl = 'Enter your ZenTao address';
|
||||
$lang->user->placeholder->email = 'Enter your email';
|
||||
|
||||
$lang->user->placeholder->passwordStrength[0] = '≥6 letters.';
|
||||
$lang->user->placeholder->passwordStrength[1] = 'Buchstaben und Ziffern. Mindestens 6 Zeichen';
|
||||
$lang->user->placeholder->passwordStrength[2] = 'Buchstaben, Ziffern und Sonderzeichen. Mindestens 10 Zeichen';
|
||||
|
||||
$lang->user->placeholder->passwordStrengthCheck[0] = 'The password should be ≥ 6 letters.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[1] = 'The password should be ≥ 6 letters, combination of uppercase, lowercase letters and numbers.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[2] = 'The password should be ≥ 10 letters, combination of uppercase, lowercase letters, numbers, and special symbols.';
|
||||
|
||||
$lang->user->error = new stdclass();
|
||||
$lang->user->error->account = "ID %s,Konto muss Buchstaben, Unterstriche oder Ziffern enthalten. Mindestens 3 Zeichen.";
|
||||
$lang->user->error->accountDupl = "ID %s,Konto wurde genutzt.";
|
||||
|
||||
@@ -224,9 +224,14 @@ $lang->user->placeholder->loginAccount = 'Enter your account';
|
||||
$lang->user->placeholder->loginUrl = 'Enter your ZenTao address';
|
||||
$lang->user->placeholder->email = 'Enter your email';
|
||||
|
||||
$lang->user->placeholder->passwordStrength[0] = '≥6 letters.';
|
||||
$lang->user->placeholder->passwordStrength[1] = '>= 6 letters and numbers';
|
||||
$lang->user->placeholder->passwordStrength[2] = '>= 10 letters, numbers and special characters';
|
||||
|
||||
$lang->user->placeholder->passwordStrengthCheck[0] = 'The password should be ≥ 6 letters.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[1] = 'The password should be ≥ 6 letters, combination of uppercase, lowercase letters and numbers.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[2] = 'The password should be ≥ 10 letters, combination of uppercase, lowercase letters, numbers, and special symbols.';
|
||||
|
||||
$lang->user->error = new stdclass();
|
||||
$lang->user->error->account = "ID %s,account must be >= 3 letters, underline or numbers";
|
||||
$lang->user->error->accountDupl = "ID %s,account is used.";
|
||||
|
||||
@@ -224,9 +224,14 @@ $lang->user->placeholder->loginAccount = 'Enter your account';
|
||||
$lang->user->placeholder->loginUrl = 'Enter your ZenTao address';
|
||||
$lang->user->placeholder->email = 'Enter your email';
|
||||
|
||||
$lang->user->placeholder->passwordStrength[0] = 'Le mot de passe doit ≥ 6 caractè res.';
|
||||
$lang->user->placeholder->passwordStrength[1] = '>= 6 lettres et chiffres';
|
||||
$lang->user->placeholder->passwordStrength[2] = '>= 10 lettres, chiffres et caractères spéciaux';
|
||||
|
||||
$lang->user->placeholder->passwordStrengthCheck[0] = 'Le mot de passe doit ≥ 6 caractères.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[1] = 'Le mot de passe doit ≥ 6 caractères, combinaison de lettres majuscules, minuscules et de chiffres.';
|
||||
$lang->user->placeholder->passwordStrengthCheck[2] = 'Le mot de passe doit ≥ 10 caractères, combinaison de lettres majuscules, minuscules, de chiffres et de symboles spéciaux.';
|
||||
|
||||
$lang->user->error = new stdclass();
|
||||
$lang->user->error->account = "ID %s,compte doit être >= 3 lettres, souligné ou chiffres";
|
||||
$lang->user->error->accountDupl = "ID %s,compte déjà utilisé par quelqu'un d'autre.";
|
||||
|
||||
@@ -224,8 +224,13 @@ $lang->user->placeholder->loginAccount = '请输入用户名';
|
||||
$lang->user->placeholder->loginUrl = '请输入禅道系统网址';
|
||||
$lang->user->placeholder->email = '请输入邮箱';
|
||||
|
||||
$lang->user->placeholder->passwordStrength[1] = '6位以上,包含大小写字母,数字。';
|
||||
$lang->user->placeholder->passwordStrength[2] = '10位以上,包含大小写字母,数字,特殊字符。';
|
||||
$lang->user->placeholder->passwordStrength[0] = '密码必须6位及以上。';
|
||||
$lang->user->placeholder->passwordStrength[1] = '6位及以上,包含大小写字母,数字。';
|
||||
$lang->user->placeholder->passwordStrength[2] = '10位及以上,包含大小写字母,数字,特殊字符。';
|
||||
|
||||
$lang->user->placeholder->passwordStrengthCheck[0] = '密码须6位及以上。';
|
||||
$lang->user->placeholder->passwordStrengthCheck[1] = '密码必须6位及以上,且包含大小写字母、数字。';
|
||||
$lang->user->placeholder->passwordStrengthCheck[2] = '密码必须10位及以上,且包含大小写字母、数字、特殊符号。';
|
||||
|
||||
$lang->user->error = new stdclass();
|
||||
$lang->user->error->account = "【ID %s】的用户名应该为:三位以上的英文、数字或下划线的组合";
|
||||
|
||||
@@ -320,7 +320,7 @@ class userModel extends model
|
||||
->setIF($this->post->password1 == false, 'password', '')
|
||||
->setIF($this->post->email != false, 'email', trim($this->post->email))
|
||||
->join('visions', ',')
|
||||
->remove('new, group, password1, password2, verifyPassword, passwordStrength')
|
||||
->remove('new, group, password1, password2, verifyPassword, passwordStrength,passwordLength')
|
||||
->get();
|
||||
|
||||
if(empty($_POST['verifyPassword']) or $this->post->verifyPassword != md5($this->app->user->password . $this->session->rand))
|
||||
@@ -544,7 +544,7 @@ class userModel extends model
|
||||
->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
|
||||
->setIF($this->post->email != false, 'email', trim($this->post->email))
|
||||
->join('visions', ',')
|
||||
->remove('new, password1, password2, groups,verifyPassword, passwordStrength')
|
||||
->remove('new, password1, password2, groups,verifyPassword, passwordStrength,passwordLength')
|
||||
->get();
|
||||
|
||||
if(empty($_POST['verifyPassword']) or $this->post->verifyPassword != md5($this->app->user->password . $this->session->rand))
|
||||
@@ -786,7 +786,7 @@ class userModel extends model
|
||||
|
||||
$user = fixer::input('post')
|
||||
->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
|
||||
->remove('account, password1, password2, originalPassword, passwordStrength')
|
||||
->remove('account, password1, password2, originalPassword, passwordStrength,passwordLength')
|
||||
->get();
|
||||
|
||||
if(empty($_POST['originalPassword']) or $this->post->originalPassword != md5($this->app->user->password . $this->session->rand))
|
||||
@@ -800,6 +800,7 @@ class userModel extends model
|
||||
$this->app->user->modifyPassword = false;
|
||||
if(!dao::isError())
|
||||
{
|
||||
if(!empty($this->app->user->modifyPasswordReason)) $this->app->user->modifyPasswordReason = '';
|
||||
$this->loadModel('score')->create('user', 'changePassword', $this->computePasswordStrength($this->post->password1));
|
||||
}
|
||||
}
|
||||
@@ -818,7 +819,7 @@ class userModel extends model
|
||||
$user = $this->getById($this->post->account);
|
||||
if(!$user) return false;
|
||||
|
||||
$password = md5($this->post->password1);
|
||||
$password = substr($this->post->password1, 0, 32);
|
||||
$this->dao->update(TABLE_USER)->set('password')->eq($password)->autoCheck()->where('account')->eq($this->post->account)->exec();
|
||||
return !dao::isError();
|
||||
}
|
||||
@@ -833,17 +834,28 @@ class userModel extends model
|
||||
{
|
||||
$_POST['password1'] = trim($_POST['password1']);
|
||||
$_POST['password2'] = trim($_POST['password2']);
|
||||
if(!$canNoPassword and empty($_POST['password1'])) dao::$errors['password'][] = sprintf($this->lang->error->notempty, $this->lang->user->password);
|
||||
if(!$canNoPassword and empty($_POST['password1'])) dao::$errors['password1'][] = sprintf($this->lang->error->notempty, $this->lang->user->password) . '<br/>';
|
||||
if($this->post->password1 != false)
|
||||
{
|
||||
if($this->post->password1 != $this->post->password2) dao::$errors['password'][] = $this->lang->error->passwordsame;
|
||||
if(!validater::checkReg($this->post->password1, '|(.){6,}|')) dao::$errors['password'][] = $this->lang->error->passwordrule;
|
||||
if(isset($this->config->safe->mode) and ($this->post->passwordStrength < $this->config->safe->mode)) dao::$errors['password1'][] = zget($this->lang->user->placeholder->passwordStrengthCheck, $this->config->safe->mode, $this->lang->user->weakPassword) . '<br/>';
|
||||
|
||||
if(isset($_POST['passwordLength']) and $this->post->passwordLength < 6 and empty(dao::$errors['password1'])) dao::$errors['password1'][] = zget($this->lang->user->placeholder->passwordStrengthCheck, 0, $this->lang->user->weakPassword) . '<br/>';
|
||||
|
||||
if($this->post->password1 != $this->post->password2) dao::$errors['password1'][] = $this->lang->error->passwordsame . '<br/>';
|
||||
|
||||
if(isset($this->config->safe->mode) and ($this->post->passwordStrength < $this->config->safe->mode)) dao::$errors['password'] = zget($this->lang->user->placeholder->passwordStrength, $this->config->safe->mode, $this->lang->user->weakPassword);
|
||||
if(!empty($this->config->safe->changeWeak))
|
||||
{
|
||||
if(!isset($this->config->safe->weak)) $this->app->loadConfig('admin');
|
||||
if(strpos(",{$this->config->safe->weak},", ",{$this->post->password1},") !== false) dao::$errors['password1'][] = sprintf($this->lang->user->errorWeak, $this->config->safe->weak);
|
||||
|
||||
if(strpos(",{$this->config->safe->weak},", ",{$this->post->password1},") !== false) dao::$errors['password1'] = sprintf($this->lang->user->errorWeak, $this->config->safe->weak);
|
||||
|
||||
$weaks = array();
|
||||
foreach(explode(',', $this->config->safe->weak) as $weak)
|
||||
{
|
||||
$weak = md5(trim($weak));
|
||||
$weaks[$weak] = $weak;
|
||||
}
|
||||
if(isset($weaks[substr($this->post->password1, 0, 32)])) dao::$errors['password1'] = sprintf($this->lang->user->errorWeak, $this->config->safe->weak);
|
||||
}
|
||||
}
|
||||
return !dao::isError();
|
||||
@@ -1656,7 +1668,6 @@ class userModel extends model
|
||||
$strength = 0;
|
||||
$length = strlen($password);
|
||||
|
||||
$uniqueChars = '';
|
||||
$complexity = array();
|
||||
$chars = str_split($password);
|
||||
foreach($chars as $letter)
|
||||
@@ -1664,7 +1675,7 @@ class userModel extends model
|
||||
$asc = ord($letter);
|
||||
if($asc >= 48 && $asc <= 57)
|
||||
{
|
||||
$complexity[2] = 2;
|
||||
$complexity[0] = 1;
|
||||
}
|
||||
elseif($asc >= 65 && $asc <= 90)
|
||||
{
|
||||
@@ -1672,20 +1683,17 @@ class userModel extends model
|
||||
}
|
||||
elseif($asc >= 97 && $asc <= 122)
|
||||
{
|
||||
$complexity[0] = 1;
|
||||
$complexity[2] = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
$complexity[3] = 3;
|
||||
$complexity[3] = 8;
|
||||
}
|
||||
if(strpos($uniqueChars, $letter) === false) $uniqueChars .= $letter;
|
||||
}
|
||||
if(strlen($uniqueChars) > 4)$strength += strlen($uniqueChars) - 4;
|
||||
$strength += array_sum($complexity) + (2 * (count($complexity) - 1));
|
||||
if($length < 6 and $strength >= 10) $strength = 9;
|
||||
$sumComplexity = array_sum($complexity);
|
||||
|
||||
$strength = $strength > 29 ? 29 : $strength;
|
||||
$strength = floor($strength / 10);
|
||||
if(($sumComplexity == 7 or $sumComplexity == 15) and $length >= 6) $strength = 1;
|
||||
if($sumComplexity == 15 and $length >= 10) $strength = 2;
|
||||
|
||||
return $strength;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/datepicker.html.php';?>
|
||||
<?php js::import($jsRoot . 'md5.js');?>
|
||||
<?php if(!empty($config->safe->mode)) $lang->user->placeholder->password1 = $lang->user->placeholder->passwordStrength[$config->safe->mode]?>
|
||||
<?php $lang->user->placeholder->password1 = zget($lang->user->placeholder->passwordStrength, $config->safe->mode, '');?>
|
||||
<?php js::set('holders', $lang->user->placeholder);?>
|
||||
<?php js::set('roleGroup', $roleGroup);?>
|
||||
<?php
|
||||
@@ -110,6 +110,7 @@ $showVisionList = count($visionList) > 1;
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php if(!$showVisionList) echo html::hidden("visions[]", $this->config->vision);?>
|
||||
<?php echo html::hidden('passwordLength', 0);?>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::a($this->createLink('company', 'browse'), $lang->goback, '', "class='btn btn-wide'")?>
|
||||
</td>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<td>
|
||||
<input type='password' style="display:none"> <!-- Disable input password by browser automatically. -->
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control disabled-ie-placeholder' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)' placeholder='" . (!empty($config->safe->mode) ? $lang->user->placeholder->passwordStrength[$config->safe->mode] : '') . "'");?>
|
||||
<?php echo html::password('password1', '', "class='form-control disabled-ie-placeholder' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)' placeholder='" . zget($lang->user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</td>
|
||||
@@ -117,6 +117,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center form-actions'>
|
||||
<?php echo html::hidden('passwordLength', 0);?>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<?php js::import($jsRoot . 'md5.js');?>
|
||||
<?php if($needCreateFile):?>
|
||||
<div class='container mw-700px' style='margin-top:100px;'>
|
||||
<div class='panel panel-default'>
|
||||
@@ -34,7 +35,7 @@
|
||||
<div class='panel-heading'>
|
||||
<strong><?php echo $lang->user->resetPassword?></strong>
|
||||
</div>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<form method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->account?></th>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
include '../../common/view/header.lite.html.php';
|
||||
?>
|
||||
<?php js::import($jsRoot . 'md5.js');?>
|
||||
<?php js::set('expired', $expired);?>
|
||||
<?php if($expired):?>
|
||||
<style>body {background: none;}</style>
|
||||
@@ -28,7 +29,7 @@ include '../../common/view/header.lite.html.php';
|
||||
<div class='form-group'>
|
||||
<label for='password1'><?php echo $lang->user->password;?></label>
|
||||
<span class='input-group'>
|
||||
<?php echo html::password('password1', '', "class='form-control' required placeholder='{$lang->user->placeholder->loginPassword}' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)'");?>
|
||||
<?php echo html::password('password1', '', "class='form-control' required placeholder='" . zget($lang->user->placeholder->loginPassword, $config->safe->mode, '') . "' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)'");?>
|
||||
<span class='input-group-addon' id='passwordStrength'></span>
|
||||
</span>
|
||||
</div>
|
||||
@@ -41,6 +42,7 @@ include '../../common/view/header.lite.html.php';
|
||||
<?php
|
||||
echo html::hidden('account', $user->account);
|
||||
echo html::hidden('passwordStrength', '');
|
||||
echo html::hidden('passwordLength', 0);
|
||||
echo html::submitButton($lang->user->submit);
|
||||
echo html::a(inlink('login'), $lang->goback, '', 'class="btn btn-wide"');
|
||||
?>
|
||||
@@ -49,6 +51,7 @@ include '../../common/view/header.lite.html.php';
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php echo html::hidden('verifyRand', $rand);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -505,7 +505,6 @@ function computePasswordStrength(password)
|
||||
var strength = 0;
|
||||
var length = password.length;
|
||||
|
||||
var uniqueChars = '';
|
||||
var complexity = new Array();
|
||||
for(i = 0; i < length; i++)
|
||||
{
|
||||
@@ -513,7 +512,7 @@ function computePasswordStrength(password)
|
||||
var asc = letter.charCodeAt();
|
||||
if(asc >= 48 && asc <= 57)
|
||||
{
|
||||
complexity[2] = 2;
|
||||
complexity[0] = 1;
|
||||
}
|
||||
else if((asc >= 65 && asc <= 90))
|
||||
{
|
||||
@@ -521,28 +520,19 @@ function computePasswordStrength(password)
|
||||
}
|
||||
else if(asc >= 97 && asc <= 122)
|
||||
{
|
||||
complexity[0] = 1;
|
||||
complexity[2] = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
complexity[3] = 3;
|
||||
complexity[3] = 8;
|
||||
}
|
||||
if(uniqueChars.indexOf(letter) == -1) uniqueChars += letter;
|
||||
}
|
||||
|
||||
if(uniqueChars.length > 4) strength += uniqueChars.length - 4;
|
||||
var sumComplexity = 0;
|
||||
var complexitySize = 0;
|
||||
for(i in complexity)
|
||||
{
|
||||
complexitySize += 1;
|
||||
sumComplexity += complexity[i];
|
||||
}
|
||||
strength += sumComplexity + (2 * (complexitySize - 1));
|
||||
if(length < 6 && strength >= 10) strength = 9;
|
||||
for(i in complexity) sumComplexity += complexity[i];
|
||||
|
||||
strength = strength > 29 ? 29 : strength;
|
||||
strength = Math.floor(strength / 10);
|
||||
if((sumComplexity == 7 || sumComplexity == 15) && password.length >= 6) strength = 1;
|
||||
if(sumComplexity == 15 && password.length >= 10) strength = 2;
|
||||
|
||||
return strength;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user