From 7a123fd8b63e4a0a234135e9ca748eafc259a2d0 Mon Sep 17 00:00:00 2001 From: RSpeekenbrink <98remco@gmail.com> Date: Thu, 2 May 2019 10:12:14 +0200 Subject: [PATCH] Add Exception when paramater is less than 6 for setCodeLength --- PHPGangsta/GoogleAuthenticator.php | 4 ++++ 1 file changed, 4 insertions(+) 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;