original_docstring: Hook for authenticating users in FlaskBB.
      This hook should return either an instance of
      :class:`flaskbb.user.models.User` or None.
  
      If a hook decides that all attempts for authentication
      should end, it may raise a
      :class:`flaskbb.core.exceptions.StopAuthentication`
      and include a reason why authentication was stopped.
  
  
      Only the first User result will used and the default FlaskBB
      authentication is tried last to give others an attempt to
      authenticate the user instead.
  
      See also:
      :class:`AuthenticationProvider<flaskbb.core.auth.AuthenticationProvider>`
  
      Example of alternative auth::
  
          def ldap_auth(identifier, secret):
              "basic ldap example with imaginary ldap library"
              user_dn = "uid={},ou=flaskbb,dc=flaskbb,dc=org"
              try:
                  ldap.bind(user_dn, secret)
                  return User.query.join(
                      UserLDAP
                  ).filter(
                      UserLDAP.dn==user_dn
                  ).with_entities(User).one()
              except:
                  return None
  
          @impl
          def flaskbb_authenticate(identifier, secret):
              return ldap_auth(identifier, secret)
  
      Example of ending authentication::
  
          def prevent_login_with_too_many_failed_attempts(identifier):
              user = User.query.filter(
                  db.or_(
                      User.username == identifier,
                      User.email == identifier
                  )
              ).first()
  
              if user is not None:
                  if has_too_many_failed_logins(user):
                      raise StopAuthentication(_(
                          "Your account is temporarily locked due to too many"
                          " login attempts"
                      ))
  
          @impl(tryfirst=True)
          def flaskbb_authenticate(user, identifier):
              prevent_login_with_too_many_failed_attempts(identifier)
  
      
docstring: Hook for authenticating users in FlaskBB.
  This hook should return either an instance of
docstring_tokens: Hook for authenticating users in FlaskBB . This hook should return either an instance of
code: def flaskbb_authenticate(identifier, secret):
      """Hook for authenticating users in FlaskBB.
      This hook should return either an instance of
      :class:`flaskbb.user.models.User` or None.
  
      If a hook decides that all attempts for authentication
      should end, it may raise a
      :class:`flaskbb.core.exceptions.StopAuthentication`
      and include a reason why authentication was stopped.
  
  
      Only the first User result will used and the default FlaskBB
      authentication is tried last to give others an attempt to
      authenticate the user instead.
  
      See also:
      :class:`AuthenticationProvider<flaskbb.core.auth.AuthenticationProvider>`
  
      Example of alternative auth::
  
          def ldap_auth(identifier, secret):
              "basic ldap example with imaginary ldap library"
              user_dn = "uid={},ou=flaskbb,dc=flaskbb,dc=org"
              try:
                  ldap.bind(user_dn, secret)
                  return User.query.join(
                      UserLDAP
                  ).filter(
                      UserLDAP.dn==user_dn
                  ).with_entities(User).one()
              except:
                  return None
  
          @impl
          def flaskbb_authenticate(identifier, secret):
              return ldap_auth(identifier, secret)
  
      Example of ending authentication::
  
          def prevent_login_with_too_many_failed_attempts(identifier):
              user = User.query.filter(
                  db.or_(
                      User.username == identifier,
                      User.email == identifier
                  )
              ).first()
  
              if user is not None:
                  if has_too_many_failed_logins(user):
                      raise StopAuthentication(_(
                          "Your account is temporarily locked due to too many"
                          " login attempts"
                      ))
  
          @impl(tryfirst=True)
          def flaskbb_authenticate(user, identifier):
              prevent_login_with_too_many_failed_attempts(identifier)
  
      """
code_tokens: def flaskbb_authenticate ( identifier , secret ) :
short_docstring: Hook for authenticating users in FlaskBB.
short_docstring_tokens: Hook for authenticating users in FlaskBB .
comment: """Hook for authenticating users in FlaskBB.
      This hook should return either an instance of
      :class:`flaskbb.user.models.User` or None.
  
      If a hook decides that all attempts for authentication
      should end, it may raise a
      :class:`flaskbb.core.exceptions.StopAuthentication`
      and include a reason why authentication was stopped.
  
  
      Only the first User result will used and the default FlaskBB
      authentication is tried last to give others an attempt to
      authenticate the user instead.
  
      See also:
      :class:`AuthenticationProvider<flaskbb.core.auth.AuthenticationProvider>`
  
      Example of alternative auth::
  
          def ldap_auth(identifier, secret):
              "basic ldap example with imaginary ldap library"
              user_dn = "uid={},ou=flaskbb,dc=flaskbb,dc=org"
              try:
                  ldap.bind(user_dn, secret)
                  return User.query.join(
                      UserLDAP
                  ).filter(
                      UserLDAP.dn==user_dn
                  ).with_entities(User).one()
              except:
                  return None
  
          @impl
          def flaskbb_authenticate(identifier, secret):
              return ldap_auth(identifier, secret)
  
      Example of ending authentication::
  
          def prevent_login_with_too_many_failed_attempts(identifier):
              user = User.query.filter(
                  db.or_(
                      User.username == identifier,
                      User.email == identifier
                  )
              ).first()
  
              if user is not None:
                  if has_too_many_failed_logins(user):
                      raise StopAuthentication(_(
                          "Your account is temporarily locked due to too many"
                          " login attempts"
                      ))
  
          @impl(tryfirst=True)
          def flaskbb_authenticate(user, identifier):
              prevent_login_with_too_many_failed_attempts(identifier)
  
      """