Commit 75b820a80bdd4e0bf1f04a15257ad0024ec11312

Authored by Yusuf Davids
1 parent 84311223

KTS-447

"Validation improvements needed when adding a user or group"
Fixed. Added a preg match function to check for special characters

Committed By:Yusuf Davids
Reviewed By:Jalaloedien Abrahams

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7615 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/admin/groupManagement.php
... ... @@ -645,6 +645,7 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
645 645 $data = $res['results'];
646 646 $errors = $res['errors'];
647 647 $extra_errors = array();
  648 +
648 649  
649 650 if (is_null($data['unit']) && $data['unitadmin']) {
650 651 $extra_errors['unitadmin'] = _kt("Groups without units cannot be Unit Administrators.");
... ... @@ -654,9 +655,21 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
654 655 if (!PEAR::isError($oGroup)) {
655 656 $extra_errors['group_name'][] = _kt("There is already a group with that name.");
656 657 }
  658 +
  659 +
  660 + if(preg_match('/[\!\$\#\%\^\&\*]/', $data['group_name'])){
  661 + $extra_errors['group_name'][] = _kt("You have entered an invalid character.");
  662 + }
  663 +
  664 + if ($data['group_name'] == ''){
  665 + $extra_errors['group_name'][] = _kt("You have entered an invalid name.");
  666 + }
  667 +
657 668  
658 669 if (!empty($errors) || !empty($extra_errors)) {
  670 +
659 671 return $oForm->handleError(null, $extra_errors);
  672 +
660 673 }
661 674  
662 675 $this->startTransaction();
... ...