Return True if password is expired and system is using
    password expiration, False otherwise.
186054
def check_password_expired(user):
    
    if not settings.ACCOUNT_PASSWORD_USE_HISTORY:
        return False

    if hasattr(user, "password_expiry"):
        # user-specific value
        expiry = user.password_expiry.expiry
    else:
        # use global value
        expiry = settings.ACCOUNT_PASSWORD_EXPIRY

    if expiry == 0:  # zero indicates no expiration
        return False

    try:
        # get latest password info
        latest = user.password_history.latest("timestamp")
    except PasswordHistory.DoesNotExist:
        return False

    now = datetime.datetime.now(tz=pytz.UTC)
    expiration = latest.timestamp + datetime.timedelta(seconds=expiry)

    if expiration < now:
        return True
    else:
        return False
124639
boolean expiringSoon(TokenInfo info) {
        // TODO(jasonhall): Consider varying the definition of "soon" based on the
        // original expires_in value (e.g., "soon" = 1/10th of the total time before
        // it's expired).
        return Double.valueOf(info.getExpires()) < (clock.now() + TEN_MINUTES);
    }
583259
public function isExpired()
    {
        $this->validatePrepared();

        if (!$this->sessionBag->has(self::CSRF_TKN_TIME)) {
            return true;
        } else {
            $age = time() - $this->sessionBag->get(self::CSRF_TKN_TIME);
            return $age >= $this->ttl;
        }
    }
1263557
public function checkPassword(): bool
    {
        if (!isset($this->regex)) {
            return true;
        }

        return filter_var($this->password, FILTER_VALIDATE_REGEXP, [
            'options' => [
                'regexp' => $this->regex
            ]
        ]);
    }
426001
public boolean expired(int expiration) {
        if (null == cliContext) {
            return true;
        }
        if ((daemon || cliContext.inProgress()) && !cliContext.disconnected()) {
            return false;
        }
        long l = expiration * 1000;
        return l < ($.ms() - ts);
    }
750335
def expired?(service_name)
      if entry = @record_cache[service_name]
        return Time.now > (entry.resolution_time + entry.ttl)
      else
        return true
      end
    end
344382
public boolean isExpired()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "isExpired");
        boolean expired = false;
        long curTime = System.currentTimeMillis();
        //TODO:
        if (curTime - _leaseTime > _leaseTimeout * 1000) //  30 seconds default for timeout
        {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Lease has EXPIRED for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime);
            expired = true;
        }
        else
        {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Lease has not expired for " + _recoveryIdentity + ", currenttime: " + curTime + ", storedTime: " + _leaseTime);
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "isExpired", expired);
        return expired;
    }
512160
public boolean hasValidCredentials() {
        String encryptedEncoded = storage.retrieveString(KEY_CREDENTIALS);
        Long expiresAt = storage.retrieveLong(KEY_EXPIRES_AT);
        Boolean canRefresh = storage.retrieveBoolean(KEY_CAN_REFRESH);
        return !(isEmpty(encryptedEncoded) ||
                expiresAt == null ||
                expiresAt <= getCurrentTimeInMillis() && (canRefresh == null || !canRefresh));
    }
377351
def isExpired(certificate):
    
    if isinstance(certificate, six.string_types):
        certificate = json.loads(certificate)
    expiry = certificate.get('expiry', 0)
    return expiry < int(time.time() * 1000) + 20 * 60
960160
public function isExpired()
    {
        if (null === $this->expiresAt) {
            return false;
        }

        $now = new \DateTime();

        return $this->expiresAt < $now;
    }
901038
public function isAccessTokenExpired() {
    if (null == $this->token) {
      return true;
    }

    // If the token is set to expire in the next 30 seconds.
    $expired = ($this->token['created']
        + ($this->token['expires_in'] - 30)) < time();

    return $expired;
  }
825131
private function isLongEnough(string $password): bool
    {
        if ((int) $this->constraints['minLength'] > 0) {
            return mb_strlen($password) >= (int) $this->constraints['minLength'];
        }

        return true;
    }
455063
@SuppressWarnings("ShortCircuitBoolean")
  boolean hasExpired(Node<K, V> node, long now) {
    return (expiresAfterAccess() && (now - node.getAccessTime() >= expiresAfterAccessNanos()))
        | (expiresAfterWrite() && (now - node.getWriteTime() >= expiresAfterWriteNanos()))
        | (expiresVariable() && (now - node.getVariableTime() >= 0));
  }
157112
def compare_password(expected, actual):
    """"""
    if expected == actual:
        return True, "OK"
    msg = []
    ver_exp = expected[-8:].rstrip()
    ver_act = actual[-8:].rstrip()

    if expected[:-8] != actual[:-8]:
        msg.append("Password mismatch")
    if ver_exp != ver_act:
        msg.append("asterisk_mbox version mismatch.  Client: '" +
                   ver_act + "',  Server: '" + ver_exp + "'")
    return False, ". ".join(msg)
930836
def auth_expired(self):
        
        if self._auth and self._expires:
            now_with_skew = time.time() + AUTH_TOKEN_CLOCK_SKEW_MAX
            return now_with_skew > self._expires
        return True
915609
protected function isExpired()
    {
        $exp = \DateTime::createFromFormat( 'U', $this->getClaimOrNull( self::EXPIRY ) );
        return !$exp || $exp <= ( new DateTime );
    }
977997
def is_password_valid(password):
    
    pattern = re.compile(r"^.{4,75}$")
    return bool(pattern.match(password))