From 08ce64e7375ccc3965966c8c4a3368bd734d06a6 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Fri, 18 Nov 2016 15:26:31 +0800 Subject: [PATCH] * finish task #2701. --- module/user/control.php | 21 +++++------ module/user/lang/en.php | 4 +- module/user/lang/zh-cn.php | 4 +- module/user/view/reset.html.php | 66 ++++++++++++++++++--------------- 4 files changed, 50 insertions(+), 45 deletions(-) diff --git a/module/user/control.php b/module/user/control.php index 7a23d5a648..66217210df 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -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(); } diff --git a/module/user/lang/en.php b/module/user/lang/en.php index 2442761d03..86396930fd 100644 --- a/module/user/lang/en.php +++ b/module/user/lang/en.php @@ -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 = "
For security reason, your Administrator account has to be verified.
-
Please login into your Zentao host and create the %s file.
+$lang->user->noticeResetFile = "
If you are not Administrator, please contact Administrator to reset your password.
+
If you are, please login into your Zentao host and create the %s file.

Note:

  1. Keep the ok.txt empty.
  2. diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index cc5e6f2c34..74c49539f9 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -158,8 +158,8 @@ $lang->user->contacts->or = ' 或者 '; $lang->user->resetFail = "重置密码失败,检查用户名是否存在!"; $lang->user->resetSuccess = "重置密码成功,请用新密码登录。"; -$lang->user->noticeResetFile = '
    为了安全起见,系统需要确认您的管理员身份
    -
    请登录禅道所在的服务器,创建%s文件。
    +$lang->user->noticeResetFile = '
    普通用户请联系管理员重置密码
    +
    管理员请登录禅道所在的服务器,创建%s文件。

    注意:

    1. 文件内容为空。
    2. diff --git a/module/user/view/reset.html.php b/module/user/view/reset.html.php index 9ad79f22d4..20a29fb09f 100644 --- a/module/user/view/reset.html.php +++ b/module/user/view/reset.html.php @@ -11,40 +11,48 @@ */ ?> - +
      -
      - user->noticeResetFile, $this->session->resetFileName);?> +
      +
      + user->resetPassword?> +
      +
      +
      + user->noticeResetFile, $this->session->resetFileName);?> +
      +

      lang->refresh, '', "class='btn'")?>

      +
      -

      lang->refresh, '', "class='btn'")?>

      -
      -
      -user->resetPassword?> -
      -
      - - - - - - - - - - - - - - - - - -
      user->account?>
      user->password?>
      user->password2?>
      -
      -
      +
      +
      + user->resetPassword?> +
      +
      + + + + + + + + + + + + + + + + + + +
      user->account?>
      user->password?>
      user->password2?>
      +
      +