/** * Check if token is valid. * * @return boolean true if token is valid */ public function isValidToken() { if (SecurityHelper::isValidToken($this->token, Module::param('emailWithin', 14400)) === true) { return ($this->_model = static::findOne(['token' => $this->token])) !== null; } return false; }
/** * Check if token is valid. * * @return boolean true if token is valid */ public function isValidToken() { if (SecurityHelper::isValidToken($this->token, Module::param('recoveryWithin', false)) === true) { return ($this->_user = User::findByToken($this->token, 'active')) !== null; } return false; }
/** * @inheritdoc */ public function beforeValidate() { if (parent::beforeValidate()) { $this->model_class = SecurityHelper::crc32(static::className()); return true; } return false; }
/** * Generates secure key. */ public function generateToken() { $this->secure_key = SecurityHelper::generateExpiringRandomString(); return $this; }