Commit 3a2215b8 by Alexander Makarov

fixed length constraints check to always result in correct range

parent 478560fd
...@@ -189,15 +189,15 @@ class CaptchaAction extends Action ...@@ -189,15 +189,15 @@ class CaptchaAction extends Action
*/ */
protected function generateVerifyCode() protected function generateVerifyCode()
{ {
if ($this->minLength > $this->maxLength) {
$this->maxLength = $this->minLength;
}
if ($this->minLength < 3) { if ($this->minLength < 3) {
$this->minLength = 3; $this->minLength = 3;
} }
if ($this->maxLength > 20) { if ($this->maxLength > 20) {
$this->maxLength = 20; $this->maxLength = 20;
} }
if ($this->minLength > $this->maxLength) {
$this->maxLength = $this->minLength;
}
$length = mt_rand($this->minLength, $this->maxLength); $length = mt_rand($this->minLength, $this->maxLength);
$letters = 'bcdfghjklmnpqrstvwxyz'; $letters = 'bcdfghjklmnpqrstvwxyz';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment