Merge pull request #1379 from nextcloud/stable10-backport-711

stable10 backport: Apply password policy on user creation
This commit is contained in:
Roeland Jago Douma 2016-09-13 19:35:35 +02:00 committed by GitHub
commit 318ea301c3
1 changed files with 2 additions and 0 deletions

View File

@ -83,6 +83,8 @@ class Database extends \OC\User\Backend implements \OCP\IUserBackend {
*/
public function createUser($uid, $password) {
if (!$this->userExists($uid)) {
$event = new GenericEvent($password);
$this->eventDispatcher->dispatch('OCP\PasswordPolicy::validate', $event);
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )');
$result = $query->execute(array($uid, \OC::$server->getHasher()->hash($password)));