Skip to content

Commit

Permalink
Fix Improper Authorization Check reported by Ahsan Aziz.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 20, 2021
1 parent cea35bd commit b57eb82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions htdocs/user/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@

$id = $object->create($user);
if ($id > 0) {
if (GETPOST('password')) {
$object->setPassword($user, GETPOST('password'));
if (GETPOST('password', 'none')) {
$object->setPassword($user, GETPOST('password','none'));
}
if (!empty($conf->categorie->enabled)) {
// Categories association
Expand Down
8 changes: 8 additions & 0 deletions htdocs/user/class/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,10 @@ public function create($user, $notrigger = 0)
$langs->load("errors");
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
return -1;
} elseif (preg_match('/[,@<>"\']/', $this->login)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorBadCharIntoLoginName");
return -1;
}

$this->datec = dol_now();
Expand Down Expand Up @@ -1669,6 +1673,10 @@ public function update($user, $notrigger = 0, $nosyncmember = 0, $nosyncmemberpa
$langs->load("errors");
$this->error = $langs->trans("ErrorFieldRequired", 'Login');
return -1;
} elseif (preg_match('/[,@<>"\']/', $this->login)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorBadCharIntoLoginName");
return -1;
}

$this->db->begin();
Expand Down

0 comments on commit b57eb82

Please sign in to comment.