login with Quora user and password
196730
def login(user, password)
      endpoint = URI.parse(QUORA_URI)

      http = Net::HTTP.new(endpoint.host, endpoint.port)
      resp = http.get('/login/')
      cookie = resp["set-cookie"]

      # TODO: improve this rubbish
      # get formkey value
      start = resp.body.index("Q.formkey")
      formkey = resp.body[start..start+200].split("\"")[1]

      # get window value
      start = resp.body.index("webnode2.windowId")
      window = resp.body[start..start+200].split("\"")[1]

      # get __vcon_json value
      start = resp.body.index("InlineLogin")
      vcon_json = resp.body[start..start+200]
      start = vcon_json.index("live")
      vcon_json = vcon_json[start..-1]
      vcon_json = vcon_json.split("\"")[0]
      vcon_json = vcon_json.split(":")
      vcon_json.map! { |value| "\"#{value}\"" }

      vcon_json = "[#{vcon_json.join(",")}]"
      vcon_json = CGI::escape(vcon_json)

      user = CGI::escape(user)
      password = CGI::escape(password)

      body = "json=%7B%22args%22%3A%5B%22#{user}%22%2C%22#{password}%22%2Ctrue%5D%2C%22kwargs%22%3A%7B%7D%7D&formkey=#{formkey}&window_id=#{window}&__vcon_json=#{vcon_json}&__vcon_method=do_login"

      headers = {
        "Content-Type"     => "application/x-www-form-urlencoded",
        "X-Requested-With" => "XMLHttpRequest",
        "Accept"           => "application/json, text/javascript, */*",
        "Cookie"           => cookie,
        "User-Agent"       => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10",
        "Content-Length"   => body.length.to_s,
        "Accept-Charset"   => "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
        "Accept-Language"  => "es-ES,es;q=0.8",
        "Accept-Encoding"  => "gzip,deflate,sdch",
        "Origin"           => "http://www.quora.com",
        "Host"             => "www.quora.com",
        "Referer"          => "http://www.quora.com/login/"
      }

      resp = http.post("/webnode2/server_call_POST", body, headers)

      if resp.code == "200"
        cookie
      else
        ""
      end
    end
377219
def login(self, username, password):
        
        # we could get stuck in an inconsistent state if got an exception while
        # trying to login with different credentials than what is stored so
        # we rollback the state to prevent that
        state_snapshot = self._state.copy()
        try:
            self._ajax_api.User_Login(name=username, password=password)
            self._android_api.login(account=username, password=password)
            self._manga_api.cr_login(account=username, password=password)
        except Exception as err:
            # something went wrong, rollback
            self._state = state_snapshot
            raise err
        self._state['username'] = username
        self._state['password'] = password
        return self.logged_in
472418
function loginUser(name, pass, cb) {
  // Get the user
  var db = nano().use(user_dbname)
  db.get(user_namespace+':'+name, function(err, doc) {
    if(err) return cb(err)
    
    // Check pass
    var hash = crypto.createHash('sha1')
    hash.update(pass)
    hash.update(doc.salt)
    var password_sha = hash.digest('hex')
    if(doc.password_sha === password_sha) {
      return cb(null, doc)
    }
    
    cb(new Error('Access denied.'))
  })
}
699531
def login(self, schema, username, password):
        
        self.schema = schema
        self.username = username
        self.password = password
        self.connection = schema
655172
def login(self, user_id, password):
        

        self._session = requests.session()
        self._session.verify = self._verify_certs
        self._session.auth = (user_id, password)

        try:
            self._update_capabilities()

            url_components = parse.urlparse(self.url)
            if self._dav_endpoint_version == 1:
                self._davpath = url_components.path + 'remote.php/dav/files/' + parse.quote(user_id)
                self._webdav_url = self.url + 'remote.php/dav/files/' + parse.quote(user_id)
            else:
                self._davpath = url_components.path + 'remote.php/webdav'
                self._webdav_url = self.url + 'remote.php/webdav'

        except HTTPResponseError as e:
            self._session.close()
            self._session = None
            raise e
1200994
def login
      response = post('/login', body: { username: configuration.username, password: configuration.password },
                                headers: { 'Content-Type' => 'application/json' })
      if response.code == 200
        @token = JSON.parse(response.body, symbolize_names: true, quirks_mode: true)
        true
      else
        false
      end
    end
144125
def get_login_credentials(args):
  
  if not args.username:
    args.username = raw_input("Enter Username: ")
  if not args.password:
    args.password = getpass.getpass("Enter Password: ")
417096
def _login(self, username="", password=""):
        
        self.log.debug("----------------")
        self.log.debug("Logging in (username: %s)..." % username)

        def run_query():
            return self._xmlrpc_server.LogIn(
                username, password, self.language, self.user_agent)

        info = self._safe_exec(run_query, None)
        if info is None:
            self._token = None
            return False

        self.log.debug("Login ended in %s with status: %s" %
                       (info['seconds'], info['status']))

        if info['status'] == "200 OK":
            self.log.debug("Session ID: %s" % info['token'])
            self.log.debug("----------------")
            self._token = info['token']
            return True
        else:
            # force token reset
            self.log.debug("----------------")
            self._token = None
            return False
557406
def auth(username, password):
    
    def middleware(conn):
        conn.login(username, password)
    return middleware
1111577
def login(self):
        """"""
        self._username = input("Username:")
        self._password = getpass.getpass("Password:")
        if self.get_auth_token():
            _LOGGER.debug("Login successful!")
            return True
        _LOGGER.warning("Unable to login with %s.", self._username)
        return False
796239
def _login(self, username, password):
        '''
        '''
        logger.debug('login in as user "%s"' % username)
        url = self._build_url('/auth')
        payload = {'username': username, 'password': password}
        res = self._session.post(url, json=payload)
        res.raise_for_status()
        self._access_token = res.json()['access_token']
        self._session.headers.update(
            {'Authorization': 'JWT %s' % self._access_token}
        )
353706
def login(self, user, passwd):
        
        def do_login(self, user, passwd, token=None):
            """
            Login function that handles CSRF protection (see `MediaWiki bug
            23076`_). Returns ``True`` on successful login.

            .. _`MediaWiki bug 23076`:
                https://bugzilla.wikimedia.org/show_bug.cgi?id=23076
            """
            data = {'action': 'login',
                    'lgname': user,
                    'lgpassword': passwd}
            if token:
                data['lgtoken'] = token
            result = self.call(data)
            if result['login']['result'] == 'Success':
                self._high_limits = None
                return True
            elif result['login']['result'] == 'NeedToken' and not token:
                return do_login(self, user, passwd, result['login']['token'])
            else:
                return False

        return do_login(self, user, passwd)
206767
def login(self, username, password):
        
        r0 = self.req(API_HOME)
        time.sleep(1)
        cookies = dict(r0.cookies)
        data = {
            'source': 'index_nav',
            'form_email': username,
            'form_password': password,
            'remember': 'on',
        }
        r1 = self.req(API_ACCOUNT_LOGIN, method='post', data=data)
        cookies.update(dict(r1.cookies))
        [cookies.update(dict(r.cookies)) for r in r1.history]
        if 'dbcl2' not in cookies:
            raise Exception('Authorization failed for <%s>: %s' % (username, r1.url))
        cookies.update(dict(r1.cookies))
        self.logger.info('login with username <%s>' % username)
        self.use(cookies)
        return self
806170
def login(self, password):
        

        method, url = get_URL('login')
        payload = {
            'apikey': self.config.get('apikey'),
            'username': self.username,
            'password': password,
            'source': 'Desktop'
            }

        res = getattr(self.session, method)(url, params=payload)

        if res.status_code == 200:
            return True

        hellraiser(res)
986686
def ReqUserLogin(self, user: str, pwd: str, broker: str):
        
        self.q.ReqUserLogin(BrokerID=broker, UserID=user, Password=pwd)
497665
def verify_login(user, password=None, **connection_args):
    '''
    
    '''
    # Override the connection args for username and password
    connection_args['connection_user'] = user
    connection_args['connection_pass'] = password

    dbc = _connect(**connection_args)
    if dbc is None:
        # Clear the mysql.error if unable to connect
        # if the connection fails, we simply return False
        if 'mysql.error' in __context__:
            del __context__['mysql.error']
        return False
    return True
1189588
async def login(
        username: str, password: str, brand: str,
        websession: ClientSession = None) -> API:
    """"""
    api = API(brand, websession)
    await api.authenticate(username, password)
    return api