<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def login_handler(self, config=None, prefix=None, **args):
 """HTTP Basic login handler. Respond with 401 and WWW-Authenticate header if there are no credentials or bad credentials. If there are credentials then simply check for username equal to password for validity. """

        headers = {}
        headers['Access-control-allow-origin'] = '*'
        headers['Content-type'] = 'text/html'
        auth = request.authorization
        if (auth and auth.username == auth.password):
            return self.set_cookie_close_window_response(
                "valid-http-basic-login")
        else:
            headers['WWW-Authenticate'] = (
                'Basic realm="HTTP-Basic-Auth at %s (u=p to login)"' %
                (self.name))
            return make_response("", 401, headers)