From e69e353e992a39b69b6ed3c3c463264cbd03a868 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 4 Sep 2018 16:00:04 +0800 Subject: [PATCH 1/4] * finish task #4823. --- module/common/view/customfield.html.php | 2 +- module/user/control.php | 1 + module/user/js/common.js | 2 +- module/user/js/login.js | 2 +- module/user/model.php | 29 +++++++++++++++---------- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/module/common/view/customfield.html.php b/module/common/view/customfield.html.php index 7c6e6f1e9a..adfed310c6 100644 --- a/module/common/view/customfield.html.php +++ b/module/common/view/customfield.html.php @@ -25,7 +25,7 @@
- save);?> + cancel, '', "btn close-dropdown");?> restore, 'hiddenwin', "class='btn'");?>
diff --git a/module/user/control.php b/module/user/control.php index 7a89603b1e..30645546ae 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -694,6 +694,7 @@ class user extends control if($this->post->password) $password = $this->post->password; if($this->get->password) $password = $this->get->password; + $account = trim($account); if($this->user->checkLocked($account)) { $failReason = sprintf($this->lang->user->loginLocked, $this->config->user->lockMinutes); diff --git a/module/user/js/common.js b/module/user/js/common.js index 35bfda6565..9571002df6 100644 --- a/module/user/js/common.js +++ b/module/user/js/common.js @@ -10,7 +10,7 @@ $(document).ready(function() { $('#verifyPassword').closest('form').find('#submit').click(function() { - var password = $('input#verifyPassword').val(); + var password = $('input#verifyPassword').val().trim(); var rand = $('input#verifyRand').val(); $('input#verifyPassword').val(md5(md5(password) + rand)); }); diff --git a/module/user/js/login.js b/module/user/js/login.js index abf7a8e173..241307566c 100644 --- a/module/user/js/login.js +++ b/module/user/js/login.js @@ -24,7 +24,7 @@ $(document).ready(function() $('#loginPanel #submit').click(function() { - var password = $('input:password').val(); + var password = $('input:password').val().trim(); var rand = $('input#verifyRand').val(); if(password.length != 32 && typeof(md5) == 'function') $('input:password').val(md5(md5(password) + rand)); }); diff --git a/module/user/model.php b/module/user/model.php index 6c839d900b..61ff04c705 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -206,6 +206,7 @@ class userModel extends model */ public function create() { + $_POST['account'] = trim($_POST['account']); if(!$this->checkPassword()) return; if(strtolower($_POST['account']) == 'guest') return false; @@ -236,17 +237,18 @@ class userModel extends model ->check('account', 'account') ->checkIF($this->post->email != '', 'email', 'email') ->exec(); - if($this->post->group) - { - $data = new stdClass(); - $data->account = $this->post->account; - $data->group = $this->post->group; - $this->dao->insert(TABLE_USERGROUP)->data($data)->exec(); - } - if(!dao::isError()) { - $this->loadModel('action')->create('user', $user->id, 'create'); + $userID = $this->dao->lastInsertID(); + if($this->post->group) + { + $data = new stdClass(); + $data->account = $this->post->account; + $data->group = $this->post->group; + $this->dao->insert(TABLE_USERGROUP)->data($data)->exec(); + } + + $this->loadModel('action')->create('user', $userID, 'Created'); $this->loadModel('mail'); if($this->config->mail->mta == 'sendcloud' and !empty($user->email)) $this->mail->syncSendCloud('sync', $user->email, $user->realname); } @@ -268,6 +270,7 @@ class userModel extends model $accounts = array(); for($i = 0; $i < $this->config->user->batchCreate; $i++) { + $users->account[$i] = trim($users->account[$i]); if($users->account[$i] != '') { if(strtolower($users->account[$i]) == 'guest') die(js::error(sprintf($this->lang->user->error->reserved, $i+1))); @@ -289,7 +292,7 @@ class userModel extends model $data[$i]->group = $users->group[$i] == 'ditto' ? (isset($prev['group']) ? $prev['group'] : '') : $users->group[$i]; $data[$i]->email = $users->email[$i]; $data[$i]->gender = $users->gender[$i]; - $data[$i]->password = md5($users->password[$i]); + $data[$i]->password = md5(trim($users->password[$i])); $data[$i]->commiter = $users->commiter[$i]; $data[$i]->join = empty($users->join[$i]) ? '0000-00-00' : ($users->join[$i]); $data[$i]->skype = $users->skype[$i]; @@ -356,6 +359,7 @@ class userModel extends model */ public function update($userID) { + $_POST['account'] = trim($_POST['account']); if(!$this->checkPassword(true)) return; $oldUser = $this->getById($userID, 'id'); @@ -457,7 +461,7 @@ class userModel extends model $accounts = array(); foreach($data->account as $id => $account) { - $users[$id]['account'] = $account; + $users[$id]['account'] = trim($account); $users[$id]['realname'] = $data->realname[$id]; $users[$id]['commiter'] = $data->commiter[$id]; $users[$id]['email'] = $data->email[$id]; @@ -570,6 +574,7 @@ class userModel extends model */ public function resetPassword() { + $_POST['account'] = trim($_POST['account']); if(!$this->checkPassword()) return; $user = $this->getById($this->post->account); @@ -594,6 +599,8 @@ class userModel extends model */ public function checkPassword($canNoPassword = false) { + $_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($this->post->password1 != false) { From c1ed944fd1e47b88704a90e3659ae7bf48d70da0 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 4 Sep 2018 16:17:04 +0800 Subject: [PATCH 2/4] * finish task #4822. --- module/block/control.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 0bfb9728c6..111c0c060e 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1016,9 +1016,9 @@ class block extends control ->orderBy($orderBy) ->fetchAll('id'); - $testedBuilds = $this->dao->select('build')->from(TABLE_TESTTASK)->where('product')->in(array_keys($products))->fetchPairs(); - $builds = $this->dao->select('id, product, name, bugs')->from(TABLE_BUILD)->where('id')->in($testedBuilds)->fetchGroup('product', 'id'); - $openedBugs = $this->dao->select('id, openedBuild')->from(TABLE_BUG)->where('openedBuild')->in($testedBuilds)->fetchGroup('openedBuild', 'id'); + $testedBuilds = $this->dao->select('build')->from(TABLE_TESTTASK)->where('product')->in(array_keys($products))->andWhere('project')->ne(0)->andWhere('deleted')->eq(0)->fetchPairs(); + $builds = $this->dao->select('id, product, name, bugs')->from(TABLE_BUILD)->where('id')->in($testedBuilds)->andWhere('deleted')->eq(0)->fetchGroup('product', 'id'); + $openedBugs = $this->dao->select('id, openedBuild')->from(TABLE_BUG)->where('openedBuild')->in($testedBuilds)->andWhere('deleted')->eq(0)->fetchGroup('openedBuild', 'id'); /* Get bugs. */ $bugIDList = array(); From 24c982f0a7aa93cf683a3de4548e8467de7842c4 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 4 Sep 2018 16:27:19 +0800 Subject: [PATCH 3/4] * finish task #4821. --- module/tree/model.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/module/tree/model.php b/module/tree/model.php index d013246deb..40b2fbe6ee 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1481,8 +1481,9 @@ class treeModel extends model if($this->isMergeModule($rootID, $viewType) and $viewType != 'task') $viewType .= ',story'; - $existsModules = $this->dao->select('id,branch,name')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('parent')->eq($parentModuleID)->andWhere('branch')->in($branches)->andWhere('deleted')->eq(0)->fetchAll(); - $repeatName = ''; + $existsModules = $this->dao->select('id,branch,name')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('parent')->eq($parentModuleID)->andWhere('branch')->in($branches)->andWhere('deleted')->eq(0)->fetchAll(); + $checkedModules = ','; + $repeatName = ''; foreach($modules as $id => $name) { $existed = false; @@ -1491,6 +1492,13 @@ class treeModel extends model $existed = true; $moduleID = substr($id, 2); } + + if(strpos($checkedModules, ",$name,") !== false) + { + $repeatName = $name; + break; + } + foreach($existsModules as $existsModule) { if($name == $existsModule->name and (!$existed or $moduleID != $existsModule->id) and (!isset($branches[$id]) or $branches[$id] == $existsModule->branch)) @@ -1499,6 +1507,7 @@ class treeModel extends model break 2; } } + $checkedModules .= "$name,"; } if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName))); return true; From 726b9ae75af8b6f013fe4304f0f20164986bd38d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 4 Sep 2018 16:29:05 +0800 Subject: [PATCH 4/4] * finish task #4818. --- module/task/view/batchcreate.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php index 2932725b38..fe76824883 100644 --- a/module/task/view/batchcreate.html.php +++ b/module/task/view/batchcreate.html.php @@ -68,7 +68,7 @@ '>task->estimateAB;?> '>task->estStarted;?> '>task->deadline;?> - '>task->desc;?> + '>task->desc;?> '>task->pri;?>