Browse Source

fixed length constraints check to always result in correct range

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
3a2215b833
  1. 6
      framework/yii/web/CaptchaAction.php

6
framework/yii/web/CaptchaAction.php

@ -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';

Loading…
Cancel
Save