code: def login_required(func):
          
  
          @wraps(func)
          def wrapped(*args, **kwargs):
              if g.user is None:
                  return redirect(url_for(current_app.config['LDAP_LOGIN_VIEW'],
                                          next=request.path))
              return func(*args, **kwargs)
  
          return wrapped
docs: When applied to a view function, any unauthenticated requests will
          be redirected to the view named in LDAP_LOGIN_VIEW. Authenticated
          requests do NOT require membership from a specific group.
  
          The login view is responsible for asking for credentials, checking
          them, and setting ``flask.g.user`` to the name of the authenticated
          user if the credentials are acceptable.
  
          :param func: The view function to decorate.