appwrite/src/Appwrite/Auth/Validator/Password.php

44 lines
689 B
PHP
Raw Normal View History

2019-05-09 06:54:39 +00:00
<?php
namespace Appwrite\Auth\Validator;
2019-05-09 06:54:39 +00:00
use Utopia\Validator;
/**
* Password.
2019-05-09 06:54:39 +00:00
*
* Validates user password string
*/
class Password extends Validator
{
/**
* Get Description.
2019-05-09 06:54:39 +00:00
*
* Returns validator description
*
* @return string
*/
public function getDescription()
{
return 'Password must be between 6 and 32 chars and contain ...';
}
/**
* Is valid.
2019-05-09 06:54:39 +00:00
*
* Validation username
*
* @param mixed $value
*
2019-05-09 06:54:39 +00:00
* @return bool
*/
public function isValid($value)
{
if (strlen($value) < 6 || strlen($value) > 32) {
return false;
}
return true;
}
}