-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James Botting <[email protected]> Merge of the following commits from branch: Rebuild webpack Prevent account enumeration The granular errors shown here can allow an attacker to enumerate valid accounts in the system and increase the attack surface Relocate user disable code If any of the code should error after the creation of the user, the user may then have a valid account to login with when this is not expected. Relocate the code to disable the user immediately after user creation Update backend code for changes
- Loading branch information
Showing
13 changed files
with
481 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2017 Julius Härtl <[email protected]> | ||
* | ||
* @author Julius Härtl <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\Registration\Db; | ||
|
||
use OCP\AppFramework\Db\Entity; | ||
|
||
/** | ||
* @method string getEmailDomains() | ||
* @method void setEmailDomains(string $email) | ||
* @method string getGroupId() | ||
* @method void setGroupId(string $groupid) | ||
*/ | ||
class Group extends Entity { | ||
public $id; | ||
protected $emailDomains; | ||
protected $groupId; | ||
|
||
public function __construct() { | ||
$this->addType('emailDomains', 'string'); | ||
$this->addType('groupId', 'string'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2017 Julius Härtl <[email protected]> | ||
* | ||
* @author Julius Härtl <[email protected]> | ||
* @author Thomas Citharel <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\Registration\Db; | ||
|
||
use OCP\AppFramework\Db\DoesNotExistException; | ||
use OCP\AppFramework\Db\Entity; | ||
use OCP\AppFramework\Db\MultipleObjectsReturnedException; | ||
use OCP\AppFramework\Db\QBMapper; | ||
use OCP\DB\Exception; | ||
use OCP\DB\QueryBuilder\IQueryBuilder; | ||
use OCP\IDBConnection; | ||
use OCP\Security\ISecureRandom; | ||
|
||
class GroupMapper extends QBMapper { | ||
public function __construct(IDBConnection $db, protected ISecureRandom $random) { | ||
parent::__construct($db, 'registration_group', Group::class); | ||
} | ||
|
||
/** | ||
* @return Group[] | ||
*/ | ||
public function getGroupMappings(): array { | ||
$qb = $this->db->getQueryBuilder(); | ||
$qb | ||
->select('*') | ||
->from($this->tableName); | ||
|
||
return $this->findEntities($qb); | ||
} | ||
|
||
/** | ||
* @return Group|null | ||
*/ | ||
public function getGroupMappingByEmailDomain($emailDomain): ?Group { | ||
try { | ||
$qb = $this->db->getQueryBuilder(); | ||
$qb | ||
->select('*') | ||
->from($this->tableName) | ||
->where($qb->expr()->like('email_domains', $qb->createNamedParameter("%".$emailDomain."%", IQueryBuilder::PARAM_STR))); | ||
|
||
return $this->findEntity($qb); | ||
} catch( \Exception ) { | ||
return null; | ||
} | ||
} | ||
|
||
/** | ||
* @return Group | ||
*/ | ||
public function getById($id): Group { | ||
$qb = $this->db->getQueryBuilder(); | ||
$qb | ||
->select('*') | ||
->from($this->tableName) | ||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))); | ||
|
||
return $this->findEntity($qb); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.