Check if email link expired
353971
def email_link_expired(self, now=None):
        
        if not now: now = datetime.datetime.utcnow()
        return self.email_link_expires < now
1327172
function onSignInWithEmailLink() {
  var email = $('#sign-in-with-email-link-email').val();
  var link = $('#sign-in-with-email-link-link').val() || undefined;
  if (auth.isSignInWithEmailLink(link)) {
    auth.signInWithEmailLink(email, link).then(onAuthSuccess, onAuthError);
  } else {
    alertError('Sign in link is invalid');
  }
}
613893
async def is_expired(self):
        
        if asyncio.iscoroutinefunction(self.state):
            current_state = await self.state()
        else:
            current_state = self.state()
        if current_state:
            return current_state != "leased"
        return False
1302882
def check_date (self):
        
        now = datetime.date.today()
        if now.day == 7 and now.month == 1:
            msg = _("Happy birthday for LinkChecker, I'm %d years old today!")
            self.comment(msg % (now.year - 2000))
915031
public static function expired($key)
    {
        static::$with_meta = true;

        $cache = static::get($key);

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

        static::$with_meta = false;

        return $cache['__bow_meta']['expire_at'] == '+'
            ? false
            : (time() > $cache['__bow_meta']['expire_at']);
    }
913881
def _cache_is_expired():
        """"""
        now = timezone.now()
        timediff = TransCache.SINGLETON_CREATION_DATETIME - now
        return (timediff.total_seconds() > TransCache.SINGLETON_EXPIRATION_MAX_SECONDS)
184531
def valid_email(x: str) -> bool:
    
    if isinstance(x, str) and re.match(EMAIL_PATTERN, x):
        return True
    else:
        return False
1140496
def check_auth():
    
    if get_oauth_token():
        auth_info = get_auth_info()
        if not auth_info:
            raise MissingTokenInfoException("Could not get token info")
        if datetime.now() >= auth_info['expires_at']:
            msg = (
                'Token is expired. Now %s but valid until %s',
                datetime.now(), auth_info['expires_at']
            )

            log.warn(
                msg[0], *msg[1:]
            )
            raise TokenIsExpired(msg[0] % msg[1:])
    else:
        raise MissingTokenException()
807188
function checkemail(next) {
      if (user.email) {
        userent.load$({ email: user.email }, function(err, userfound) {
          if (err) return done(err, { ok: false, user: user })
          if (userfound)
            return done(null, {
              ok: false,
              why: 'email-exists',
              nick: args.nick
            })
          next()
        })
        return
      }
      next()
    }
1195268
def cancel_expired_invitations(invitations=None):
    
    expiration_date = timezone.now() - settings.WALDUR_CORE['INVITATION_LIFETIME']
    if not invitations:
        invitations = models.Invitation.objects.filter(state=models.Invitation.State.PENDING)
    invitations = invitations.filter(created__lte=expiration_date)
    invitations.update(state=models.Invitation.State.EXPIRED)
304225
def check_email():
    """"""
    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.ehlo()
    server.starttls()
    server.ehlo()
    server.login(user, password)

    g = gmail.login(user, password)

    # Check for unread messages.
    unread = g.inbox().mail(unread=True)

    # Submit a job to lint each email sent to editor@proselint.com. Record the
    # resulting job_ids somewhere (in Redis, I suppose), keyed by a hash of the
    # email.
    for u in unread:

        u.fetch()

        signature = (u.fr.decode('utf-8') +
                     u.subject.decode('utf-8') +
                     u.body.decode('utf-8'))

        hash = hashlib.sha256(signature.encode('utf-8')).hexdigest()

        if user_to in u.to or user_to in u.headers.get('Cc', []):

            job_id = conn.get(hash)

            if not job_id:
                # If the email hasn't been sent for processing, send it.
                r = requests.post(api_url, data={"text": u.body})
                conn.set(hash, r.json()["job_id"])
                print("Email {} sent for processing.".format(hash))

            else:
                # Otherwise, check whether the results are ready, and if so,
                # reply with them.
                r = requests.get(api_url, params={"job_id": job_id})

                if r.json()["status"] == "success":

                    reply = quoted(u.body)
                    errors = r.json()['data']['errors']
                    reply += "\r\n\r\n".join([json.dumps(e) for e in errors])

                    msg = MIMEMultipart()
                    msg["From"] = "{} <{}>".format(name, user)
                    msg["To"] = u.fr
                    msg["Subject"] = "Re: " + u.subject

                    if u.headers.get('Message-ID'):
                        msg.add_header("In-Reply-To", u.headers['Message-ID'])
                        msg.add_header("References", u.headers['Message-ID'])

                    body = reply + "\r\n\r\n--\r\n" + tagline + "\r\n" + url
                    msg.attach(MIMEText(body, "plain"))

                    text = msg.as_string()
                    server.sendmail(user, u.fr, text)

                    # Mark the email as read.
                    u.read()
                    u.archive()

                    print("Email {} has been replied to.".format(hash))
966275
def confirm_email_token_status(token):
    
    expired, invalid, user, token_data = \
        get_token_status(token, 'confirm', 'CONFIRM_EMAIL', return_data=True)
    if not invalid and user:
        user_id, token_email_hash = token_data
        invalid = not verify_hash(token_email_hash, user.email)
    return expired, invalid, user
1257978
function filter_email(value) {
    var m = EMAIL_RE.exec(value);
    if(m == null) throw OptError('Excpeted an email address.');
    return m[1];
}
1235480
def is_valid(email):
        
        if isinstance(email, basestring) and EMAIL_RE.match(email):
            return True
        return False
544059
def should_return_304(self) -> bool:
        
        # If client sent If-None-Match, use it, ignore If-Modified-Since
        if self.request.headers.get("If-None-Match"):
            return self.check_etag_header()

        # Check the If-Modified-Since, and don't send the result if the
        # content has not been modified
        ims_value = self.request.headers.get("If-Modified-Since")
        if ims_value is not None:
            date_tuple = email.utils.parsedate(ims_value)
            if date_tuple is not None:
                if_since = datetime.datetime(*date_tuple[:6])
                assert self.modified is not None
                if if_since >= self.modified:
                    return True

        return False
750335
def expired?(service_name)
      if entry = @record_cache[service_name]
        return Time.now > (entry.resolution_time + entry.ttl)
      else
        return true
      end
    end
713471
def expired(self):
    """"""
    expiry_time = self.expiry_time
    if expiry_time is not None:
      return expiry_time < rdfvalue.RDFDatetime.Now()
    else:
      return False