Finds out if password reset token is valid

@param string $token password reset token
@return boolean
185165
public static function isPasswordResetTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $expire = Yii::$app->cms->passwordResetTokenExpire;
        $parts = explode('_', $token);
        $timestamp = (int)end($parts);
        return $timestamp + $expire >= time();
    }
538251
public static function findByPasswordResetToken(string $token) : ?self
    {
        if (!static::isPasswordResetTokenValid($token)) {
            return null;
        }
        return static::findOne([
            'password_reset_token' => $token,
            'status' => self::STATUS_ACTIVE,
        ]);
    }
694142
private function _validate($token)
    {

        $request = $this->_httpClient->createRequest('POST', $this->_tokenServiceUrl . 'validate');
        $postBody = $request->getBody();


        // $postBody is an instance of GuzzleHttp\Post\PostBodyInterface
        $postBody->setField('service', $this->_appID);
        $postBody->setField('token', $token);

        // Send the POST request
        try {
            $response = $this->_httpClient->send($request);
        } catch (ClientException $e) {
            return "BAD_TOKEN";
        } catch (ServerException $e) {
            return "SERVER_ERROR";
        }

        return $response->json();

    }
326096
public function verify($token)
    {
        $result = $this->find('token', compact('token'))->firstOrFail();

        $event = $this->dispatchEvent('Muffin/Tokenize.beforeVerify', ['token' => $result]);
        if ($event->isStopped()) {
            return false;
        }

        if (!empty($result['foreign_data'])) {
            $table = $this->foreignTable($result);
            $fields = $result['foreign_data'];
            $conditions = [(string)$table->getPrimaryKey() => $result['foreign_key']];
            $table->updateAll($fields, $conditions);
        }

        $result->set('status', true);
        $this->save($result);

        $this->dispatchEvent('Muffin/Tokenize.afterVerify', ['token' => $result]);

        return $result;
    }
1347288
public function isValid($token)
    {
        $this->validatePrepared();

        return $this->sessionBag->has(self::CSRF_TKN_NAME) && 
               $this->sessionBag->has(self::CSRF_TKN_TIME) && 
               $this->sessionBag->get(self::CSRF_TKN_NAME) === $token;
    }
1141939
public static function isAccessTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $data = Yii::$app->jwt->getValidationData(); // It will use the current time to validate (iat, nbf and exp)
        $data->setIssuer(Yii::getAlias("@restIssuer"));
        $data->setAudience(Yii::getAlias("@restAudience"));
        $data->setId(Yii::getAlias("@restId")+strtotime(date('Y-m-d',time())), true);
        if (is_string($token))
            $token = Yii::$app->jwt->getParser()->parse($token);

        return $token->validate($data);
    }
420462
final protected static function RawVerify( string $token ) : bool {
        
        self::InitSession( );
        
        $key = self::GetSessionKey( );
        foreach( $_SESSION[ $key ] as $i => $t ) {
            if( hash_equals( $t[self::key_Token], $token ) ) {
                unset( $_SESSION[ $key ][ $i ] );
                return true;
            }
        }
        
        return false;
        
    }
694719
public function checkSignature($token = null)
    {
        $config_token = Api::getToken();
        $signature    = isset($_GET['signature']) ? $_GET['signature'] : null;
        $timestamp    = isset($_GET['timestamp']) ? $_GET['timestamp'] : null;
        $nonce        = isset($_GET['nonce']) ? $_GET['nonce'] : null;
        $token        = empty($token) ? $config_token : $token;
        $tmpArr       = [$token, $timestamp, $nonce];
        sort($tmpArr, SORT_STRING);
        $tmpStr = implode($tmpArr);
        $tmpStr = sha1($tmpStr);

        if ($tmpStr == $signature && $signature != null) {
            return $this;
        }

        return false;
    }
875581
public function isValid($token)
    {
        try {
            $publicKey = openssl_pkey_get_public(file_get_contents($this->projectDir . '/var/jwt/public.pem'));

            $jws = SimpleJWS::load($token);

            return $jws->verify($publicKey, self::ALG) && $this->isTokenNotExpired($token);
        } catch (\InvalidArgumentException $ex) {
            return false;
        }
    }
1193157
private function isConstantToken($token)
    {
        return $token == T_CONSTANT_ENCAPSED_STRING || $token == T_STRING || $token == T_LNUMBER || $token == T_DNUMBER;
    }
323664
public static function isPasswordResetTokenValid(int $expired, string $token = null): bool
    {
        if ($token === null) {
            return false;
        }
        $parts = explode('_', $token);
        $timestamp = (int)end($parts);
        return $timestamp + $expired >= time();
    }
539943
public function expireToken($token)
    {
        $tokenData = $this->getTokenData($token);
        if ($tokenData == false) {
            return false;
        }

        $tokenData->date_of_expiry = time() - 1;
        return $tokenData->save();
    }
631479
public function validateToken($token)
    {
        if (isset($_SESSION[$this->session_name])) {
            if ($_SESSION[$this->session_name] === $token) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
742464
public final boolean isValidPasswordResetToken(String token) {
		Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);
		return isValidToken(s, Config._RESET_TOKEN, token);
	}
887376
public static function verify($token)
  {
    $userToken = Password::where('token', $token)->first();

    if ($userToken == null) {
      return false;
    }

    if ($userToken->created_at->diffInMinutes() <= config('app.reset_token.expire')) {
      if (Session::has('token')) {
        if (Session::key('token') == $userToken->token) {
          return true;
        }
        else {
          Session::delete('token');
          return false;
        }
      }
      else {
        return false;
      }
    }

    $userToken->delete();
    return false;
  }
324448
public function checkLoginToken(string $token)
    {

        if ($token != cache('admin_login_token'))
            abort(404);

        $user = User::whereName('admin')->first();

        if (is_null($user))
            return redirect()->route('auth.login')
                ->withErrors('The Admin user does not exist. Re-run the seat:admin:login command.');

        // Login and clear the token we just used.
        auth()->login($user);
        cache()->delete('admin_login_token');

        return redirect()->intended('home');

    }
208452
public function isValidToken($token)
    {
        if (! $token) {
            return false;
        }

        /**
         * @var $tokenModel Token
         */
        $tokenModel = $this->tokens()->where('token', $token)->first();

        return $tokenModel ? $tokenModel->isValid() : false;
    }