This commit is contained in:
Catouse
2016-11-18 15:52:24 +08:00
4 changed files with 50 additions and 45 deletions
+9 -12
View File
@@ -820,35 +820,32 @@ class user extends control
{
if(!isset($_SESSION['resetFileName']))
{
$resetFileName = $this->app->getBasePath() . 'www' . DIRECTORY_SEPARATOR . uniqid('reset_') . '.txt';
$resetFileName = $this->app->getBasePath() . 'tmp' . DIRECTORY_SEPARATOR . uniqid('reset_') . '.txt';
$this->session->set('resetFileName', $resetFileName);
}
$resetFileName = $this->session->resetFileName;
$this->view->title = $this->lang->user->resetPassword;
$status = '';
if(!file_exists($resetFileName) or (time() - filemtime($resetFileName)) > 60 * 2) $status = 'createFile';
$needCreateFile = false;
if(!file_exists($resetFileName) or (time() - filemtime($resetFileName)) > 60 * 2) $needCreateFile = true;
if($_POST)
{
if($status == 'createFile') die(js::reload('parent'));
if($needCreateFile) die(js::reload('parent'));
$result = $this->user->resetPassword();
if(dao::isError()) die(js::error(dao::getError()));
if(!$result) die(js::alert($this->lang->user->resetFail));
echo js::alert($this->lang->user->resetSuccess);
die(js::locate(inlink('logout'), 'parent'));
$referer = $this->server->http_host . $this->createLink('index', 'index');
$referer = helper::safe64Encode($referer);
die(js::locate(inlink('logout', $referer), 'parent'));
}
if($status == 'createFile')
{
$this->view->status = $status;
die($this->display());
}
$this->view->status = 'reset';
$this->view->status = 'reset';
$this->view->needCreateFile = $needCreateFile;
$this->display();
}
+2 -2
View File
@@ -158,8 +158,8 @@ $lang->user->contacts->or = ' or ';
$lang->user->resetFail = "Reset failed. Please check the account";
$lang->user->resetSuccess = "Password reset! Please use your new password to login.";
$lang->user->noticeResetFile = "<h5>For security reason, your Administrator account has to be verified.</h5>
<h5>Please login into your Zentao host and create the %s file.</h5>
$lang->user->noticeResetFile = "<h5>If you are not Administrator, please contact Administrator to reset your password.</h5>
<h5>If you are, please login into your Zentao host and create the %s file.</h5>
<p>Note:</p>
<ol>
<li>Keep the ok.txt empty.</li>
+2 -2
View File
@@ -158,8 +158,8 @@ $lang->user->contacts->or = ' 或者 ';
$lang->user->resetFail = "重置密码失败,检查用户名是否存在!";
$lang->user->resetSuccess = "重置密码成功,请用新密码登录。";
$lang->user->noticeResetFile = '<h5>为了安全起见,系统需要确认您的管理员身份</h5>
<h5>请登录禅道所在的服务器,创建%s文件。</h5>
$lang->user->noticeResetFile = '<h5>普通用户请联系管理员重置密码</h5>
<h5>管理员请登录禅道所在的服务器,创建%s文件。</h5>
<p>注意:</p>
<ol>
<li>文件内容为空。</li>
+37 -29
View File
@@ -11,40 +11,48 @@
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php if($status == 'createFile'):?>
<?php if($needCreateFile):?>
<div class='container mw-700px' style='margin-top:100px;'>
<div class='panel-body'>
<?php printf($lang->user->noticeResetFile, $this->session->resetFileName);?>
<div class='panel'>
<div class='panel-heading'>
<strong><?php echo $lang->user->resetPassword?></strong>
</div>
<div class='panel-body'>
<div class='alert alert-info'>
<?php printf($lang->user->noticeResetFile, $this->session->resetFileName);?>
</div>
<p><?php echo html::a(inlink('reset'), $this->lang->refresh, '', "class='btn'")?></p>
</div>
</div>
<p><?php echo html::a(inlink('reset'), $this->lang->refresh, '', "class='btn'")?></p>
</div>
<?php elseif($status == 'reset'):?>
<div class='container mw-500px' style='margin-top:50px;'>
<div class='panel'>
<div class='panel-heading'>
<strong><?php echo $lang->user->resetPassword?></strong>
</div>
<form method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->user->account?></th>
<td><?php echo html::input('account', '', "class='form-control'")?></td>
</tr>
<tr>
<th><?php echo $lang->user->password?></th>
<td><?php echo html::password('password1', '', "class='form-control'")?></td>
</tr>
<tr>
<th><?php echo $lang->user->password2?></th>
<td><?php echo html::password('password2', '', "class='form-control'")?></td>
</tr>
<tr>
<th></th>
<td><?php echo html::submitButton()?></td>
</tr>
</table>
</form>
</div>
<div class='panel'>
<div class='panel-heading'>
<strong><?php echo $lang->user->resetPassword?></strong>
</div>
<form method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->user->account?></th>
<td><?php echo html::input('account', '', "class='form-control'")?></td>
</tr>
<tr>
<input type='password' style="display:none"> <!-- Disable input password by browser automatically. -->
<th><?php echo $lang->user->password?></th>
<td><?php echo html::password('password1', '', "class='form-control'")?></td>
</tr>
<tr>
<th><?php echo $lang->user->password2?></th>
<td><?php echo html::password('password2', '', "class='form-control'")?></td>
</tr>
<tr>
<th></th>
<td><?php echo html::submitButton()?></td>
</tr>
</table>
</form>
</div>
</div>
<?php endif;?>
<?php include '../../common/view/footer.lite.html.php';?>