original_docstring: Determine if a login attempt is allowed or not.
docstring: Determine if a login attempt is allowed or not.
docstring_tokens: Determine if a login attempt is allowed or not .
code: def too_many_recent_failures_for(username):
          """Determine if a login attempt is allowed or not."""
          timeframe = current_app.config['XL_AUTH_FAILED_LOGIN_TIMEFRAME']
          from_timestamp = datetime.utcnow() - timedelta(seconds=timeframe)
          attempts = FailedLoginAttempt.query.filter(
              FailedLoginAttempt.username.ilike(username),
              FailedLoginAttempt.created_at >= from_timestamp).all()
          if len(attempts) >= current_app.config['XL_AUTH_FAILED_LOGIN_MAX_ATTEMPTS']:
              return True
          else:
              return False
code_tokens: def too_many_recent_failures_for ( username ) : timeframe = current_app . config [ 'XL_AUTH_FAILED_LOGIN_TIMEFRAME' ] from_timestamp = datetime . utcnow ( ) - timedelta ( seconds = timeframe ) attempts = FailedLoginAttempt . query . filter ( FailedLoginAttempt . username . ilike ( username ) , FailedLoginAttempt . created_at >= from_timestamp ) . all ( ) if len ( attempts ) >= current_app . config [ 'XL_AUTH_FAILED_LOGIN_MAX_ATTEMPTS' ] : return True else : return False
short_docstring: Determine if a login attempt is allowed or not.
short_docstring_tokens: Determine if a login attempt is allowed or not .
comment: """Determine if a login attempt is allowed or not."""