diff --git a/PHPGangsta/GoogleAuthenticator.php b/PHPGangsta/GoogleAuthenticator.php index bf7d116..2af56e7 100644 --- a/PHPGangsta/GoogleAuthenticator.php +++ b/PHPGangsta/GoogleAuthenticator.php @@ -151,6 +151,10 @@ public function verifyCode($secret, $code, $discrepancy = 1, $currentTimeSlice = */ public function setCodeLength($length) { + if ($length < 6) { + throw new Exception('Invalid code length, should be >= 6'); + } + $this->_codeLength = $length; return $this;