Commit d1405f41 authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Token date validation

parent a7ebdb35
......@@ -24,6 +24,7 @@ use Yii;
use CHttpException;
use Survey;
use SurveyDynamic;
use Token;
class Utilities
{
......@@ -369,14 +370,20 @@ class Utilities
* @param string $token for control
* @return boolean
*/
public static function checkIsValidToken($surveyid, $token, $validtoken)
public static function checkIsValidToken($surveyid, $token, $validtoken = null)
{
if (empty($validtoken)) {
return true;
}
if (empty($token)) {
return false;
}
if (Survey::model()->findByPk($surveyid)->hasTokensTable) {
$oToken = Token::model($surveyid)->editable()->findByAttributes(array('token' => $token));
if(empty($oToken)) {
return false;
}
}
if (empty($validtoken)) {
return true;
}
if ($token == $validtoken) {
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment