Programming Language PHP
Namespace Elabftw\Services
Class Check
Method/Function passwordLength
Total Examples 2
2 code examples of PHP Elabftw\Services\Check::passwordLength extracted from open source projects
public function testPasswordLength(): void
{
$this->assertTrue(Check::passwordLength('longpassword'));
$this->expectException(ImproperActionException::class);
Check::passwordLength('short');
}
/**
* Update the password for the user
*/
public function updatePassword(string $password): bool
{
Check::passwordLength($password);
$passwordHash = password_hash($password, PASSWORD_DEFAULT);
$sql = 'UPDATE users SET password_hash = :password_hash, token = null WHERE userid = :userid';
$req = $this->Db->prepare($sql);
$req->bindParam(':password_hash', $passwordHash);
$req->bindParam(':userid', $this->userData['userid'], PDO::PARAM_INT);
return $this->Db->execute($req);
}