Checks the given credentials for a valid login and returns a new
        session.
963676
async def login(cls: Type[_SessionT],
                    credentials: AuthenticationCredentials,
                    config: Config) -> _SessionT:
        
        user = credentials.authcid
        password, user_dir = await cls.find_user(config, user)
        if user != credentials.identity:
            raise InvalidAuth()
        elif not credentials.check_secret(password):
            raise InvalidAuth()
        maildir, layout = cls._load_maildir(config, user_dir)
        mailbox_set = MailboxSet(maildir, layout)
        filter_set = FilterSet(layout.path)
        return cls(credentials.identity, config, mailbox_set, filter_set)
1327521
def login_generic(request, username, password):
        """"""
        user = authenticate(username=username, password=password)
        if user is not None and user.is_active:
            login(request, user)
            return True
        return False
1142010
def from_credentials(credentials):
        
        return API(username=credentials.username, password=credentials.password,
                   database=credentials.database, session_id=credentials.session_id,
                   server=credentials.server)
50364
def login(provider_id):
    """"""
    provider = get_provider_or_404(provider_id)
    callback_url = get_authorize_callback('login', provider_id)
    post_login = request.form.get('next', get_post_login_redirect())
    session[config_value('POST_OAUTH_LOGIN_SESSION_KEY')] = post_login
    return provider.authorize(callback_url)
817310
def session_login(self, user=None, passwd=None):
        
        self.change_credentials(user=user, auth_token=passwd)
479509
def authenticate(self):
        '''
        
        '''
        if "username" in self.options and "password" in self.options:
            self.login_oauth2(
                self.options["username"],
                self.options["password"],
                self.options.get('mfa_code'))
        elif "access_token" in self.options:
            if "refresh_token" in self.options:
                self.access_token = self.options["access_token"]
                self.refresh_token = self.options["refresh_token"]
                self.__set_account_info()
        else:
            self.authenticated = False
        return self.authenticated
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
687450
def confirm_login():
    '''
    
    '''
    session['_fresh'] = True
    session['_id'] = current_app.login_manager._session_identifier_generator()
    user_login_confirmed.send(current_app._get_current_object())
830004
def login(self, username, password):
        
        self._user = username
        self._pass = password
        return self._login()
1004024
def _authenticate(self, client):
        """"""
        yield client.authenticate(
            self._username, self._password, mechanism=self._auth_mechanism)
        returnValue(client)
569707
def login(self, username=None, password=''):
        """"""
        auth = None
        if username is not None:
            # User login
            resp = self._login(username, password, self.client_id, self.client_secret)
            msg = "User Login"
        else:
            # client credentials
            resp = self._client(self.client_id, self.client_secret)
            msg = "Client credentials"
        if resp.status_code == requests.codes.ok:
            auth = resp.json()
            self.session.headers.update({
                'Authorization':
                    ("%s %s" % (auth['token_type'], auth['access_token']))
            })
        else:
            error = {'description': "%s not valid" % msg }
            raise UAAException(error, resp.status_code)
        return auth
188330
def check_basic_auth(self, username, password):
        
        valid = self.users.check_password(
            username, password
        )
        if not valid:
            log.warning('Invalid login from %s', username)
            valid = False
        return (
            valid,
            username
        )
56475
def get_session(username, password, locale=DEFAULT_LOCALE,
                cookie_path=COOKIE_PATH):
    """"""
    class UPSAuth(AuthBase):  # pylint: disable=too-few-public-methods
        """UPS authorization storage."""

        def __init__(self, username, password, locale, cookie_path):
            """Init."""
            self.username = username
            self.password = password
            self.locale = locale
            self.cookie_path = cookie_path

        def __call__(self, r):
            """Call is no-op."""
            return r

    session = requests.session()
    session.auth = UPSAuth(username, password, locale, cookie_path)
    if os.path.exists(cookie_path):
        session.cookies = _load_cookies(cookie_path)
    else:
        _login(session)
    return session
406008
def authenticate(self, login, passcode):
        
        return login in self.store and self.store[login] == passcode
356376
def _authenticate(self):
        """"""
        data = {'username': self.username,
                'password': self.password}
        url = '{base}/client/login'.format(base=self.base_url)
        response = self._session.get(url, params=data)
        print(response.text)
        data = response.json()
        if not data.get('success'):
            raise InvalidCredentials(data.get('reason', None))
        self._populate_info(data)
1272411
def make_http_credentials(username=None, password=None):
    """"""
    credentials = ''
    if username is None:
        return credentials
    if username is not None:
        if ':' in username:
            return credentials
        credentials += username
    if credentials and password is not None:
        credentials += ":%s" % password
    return "%s@" % credentials
94089
def create_session(user):
    

    def cb():
        if user:
            if __options__.get("require_email_verification") and not user.email_verified:
                raise exceptions.VerifyEmailError()
            if flask_login.login_user(user):
                user.update(last_login_at=utc_now())
                return user
        return None

    return signals.user_login(cb)