From 42283dade239e762d90009e8e8d0fec2f9e6fbb3 Mon Sep 17 00:00:00 2001
From: Antonin <antonin.murtin@gmail.com>
Date: Fri, 29 Apr 2016 18:46:22 +0200
Subject: [PATCH] Token default lenght

---
 app/classes/Framadate/Security/Token.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/classes/Framadate/Security/Token.php b/app/classes/Framadate/Security/Token.php
index b4a4b9bd..ec663478 100644
--- a/app/classes/Framadate/Security/Token.php
+++ b/app/classes/Framadate/Security/Token.php
@@ -3,12 +3,13 @@ namespace Framadate\Security;
 
 class Token {
 
+    const DEFAULT_LENGTH = 64;
     private $time;
     private $value;
     private $length;
     private static $codeAlphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789';
 
-    function __construct($length = 64) {
+    function __construct($length = self::DEFAULT_LENGTH) {
         $this->length = $length;
         $this->time = time() + TOKEN_TIME;
         $this->value = $this->generate();
@@ -41,7 +42,7 @@ class Token {
      * @param bool $crypto_strong If passed, tells if the token is "cryptographically strong" or not.
      * @return string
      */
-    public static function getToken($length, &$crypto_strong = false) {
+    public static function getToken($length = self::DEFAULT_LENGTH, &$crypto_strong = false) {
         if (function_exists('openssl_random_pseudo_bytes')) {
             openssl_random_pseudo_bytes(1, $crypto_strong); // Fake use to see if the algorithm used was "cryptographically strong"
             return self::getSecureToken($length);
-- 
GitLab