Fix API key substr

This commit is contained in:
Nabeel Shahzad
2017-12-30 13:41:34 -06:00
parent 92dfea4424
commit c4cbffd9ea
2 changed files with 7 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ class Utils extends Facade
*/
public static function generateApiKey()
{
$key = substr(0, 12, sha1(time() . mt_rand()));
$key = substr(sha1(time() . mt_rand()), 0, 12);
return $key;
}

View File

@@ -51,4 +51,10 @@ class UtilsTest extends TestCase
$t = Utils::minutesToTimeString(43200);
$this->assertEquals('720h 0m', $t);
}
public function testApiKey()
{
$api_key = Utils::generateApiKey();
$this->assertNotNull($api_key);
}
}