This function is used to check `username` and `password` in case that
    :attr:`.settings.PRIVATE_INDEX` is set to ``True`` (default is ``False``).
171163
def check_auth(username, password):
    
    return (username == settings.PRIVATE_INDEX_USERNAME and
            settings.PRIVATE_INDEX_PASSWORD and
            password == settings.PRIVATE_INDEX_PASSWORD)
104123
def _search_for_user_dn(self):
        
        search = self.settings.USER_SEARCH
        if search is None:
            raise ImproperlyConfigured(
                "AUTH_LDAP_USER_SEARCH must be an LDAPSearch instance."
            )

        results = search.execute(self.connection, {"user": self._username})
        if results is not None and len(results) == 1:
            (user_dn, self._user_attrs) = next(iter(results))
        else:
            user_dn = None

        return user_dn
237574
def authenticate_by_password(cls, params):
        
        def verify_password(user, password):
            return crypt.check(user.password, password)

        success = False
        user = None
        login = params['login'].lower().strip()
        key = 'email' if '@' in login else 'username'
        try:
            user = cls.get_item(**{key: login})
        except Exception as ex:
            log.error(str(ex))

        if user:
            password = params.get('password', None)
            success = (password and verify_password(user, password))
        return success, user
1071507
def auth(username, password):
    '''
    
    '''
    _info = __get_connection_info()

    if _info is None:
        return False

    try:
        conn = MySQLdb.connect(_info['hostname'],
                               _info['username'],
                               _info['password'],
                               _info['database'])
    except OperationalError as e:
        log.error(e)
        return False

    cur = conn.cursor()
    cur.execute(_info['auth_sql'].format(username, password))

    if cur.rowcount == 1:
        return True

    return False
1077447
def rights_check(self, form, sub_auth, name, load, eauth=None):
        '''
        
        '''
        if load.get('eauth'):
            sub_auth = sub_auth[load['eauth']]
        good = self.ckminions.any_auth(
                form,
                sub_auth[name] if name in sub_auth else sub_auth['*'],
                load.get('fun', None),
                load.get('arg', None),
                load.get('tgt', None),
                load.get('tgt_type', 'glob'))

        # Handle possible return of dict data structure from any_auth call to
        # avoid a stacktrace. As mentioned in PR #43181, this entire class is
        # dead code and is marked for removal in Salt Neon. But until then, we
        # should handle the dict return, which is an error and should return
        # False until this class is removed.
        if isinstance(good, dict):
            return False

        if not good:
            # Accept find_job so the CLI will function cleanly
            if load.get('fun', '') != 'saltutil.find_job':
                return good
        return good
26596
def register(self, username, password, email, full_name):
        
        if all([username, password, email, full_name]):
            r = requests.post(self._base + 'user/register', params={
                'username': username,
                'password_1': password,
                'password_2': password,
                'email': email,
                'fullname': full_name
            })
            r.raise_for_status()
        else:
            raise Exception('None of the arguments may be "None"')
62973
def conceal_member(self, login):
        
        url = self._build_url('public_members', login, base_url=self._api)
        return self._boolean(self._delete(url), 204, 404)
644249
def check_basic_auth(user, passwd):
    """"""

    auth = request.authorization
    return auth and auth.username == user and auth.password == passwd
1190165
def is_private(self, key, sources):
        """"""
        # aliases are always public.
        if key == ENTRY.ALIAS:
            return False
        return all([
            SOURCE.PRIVATE in self.get_source_by_alias(x)
            for x in sources.split(',')
        ])
1127015
def check_auth(args, role=None):
    """"""
    users = boto3.resource("dynamodb").Table(os.environ['people'])
    if not (args.get('email', None) and args.get('api_key', None)):
        mesg = "Invalid request: `email` and `api_key` are required"
        return {'success': False, 'message': mesg}
    user = users.get_item(Key={'email': args.get('email')})
    if 'Item' not in user:
        return {'success': False, 'message': 'User does not exist.'}
    user = user['Item']
    if user['api_key'] != args['api_key']:
        return {'success': False, 'message': 'API key was invalid.'}
    if role:
        if user['role'] not in role:
            mesg = 'User is not authorized to make this change.'
            return {'success': False, 'message': mesg}
    return {'success': True, 'message': None, 'user': user}
1107950
def check_user(self, username, email):
        ''''''
        users = self.router.user
        avail = yield users.filter(username=username).count()
        if avail:
            raise FieldError('Username %s not available' % username)
        if email:
            avail = yield users.filter(email=email).count()
            if avail:
                raise FieldError('Email %s not available' % email)
1065437
def get_private_and_public(ctx, username, password, private, preset):
    """"""
    session = SRPClientSession(
        SRPContext(username, password, prime=preset[0], generator=preset[1]),
        private=private)

    click.secho('Client private: %s' % session.private_b64)
    click.secho('Client public: %s' % session.public_b64)
424866
def is_private(self):
        
        self.switch_to()
        with self.selenium.context(self.selenium.CONTEXT_CHROME):
            return self.selenium.execute_script(
                """
                Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");

                let chromeWindow = arguments[0].ownerDocument.defaultView;
                return PrivateBrowsingUtils.isWindowPrivate(chromeWindow);
                """,
                self.document_element,
            )
1180372
protected function checkAuthInput()
    {
        
        $defaults = array('user' => null,
						  'password' => null);
						  
		$this->options = array_merge($defaults, $this->options);
		
		if ($this->options['user'] == null) {
			$this->err("Please provide a value for the 'user' parameter.", true);
		}
		else if ($this->options['password'] == null) {
			$this->err("Please provide a value for the 'password' parameter.", true);
		}
        
    }
802031
def username(self, value):
        """"""
        if isinstance(value, str):
            self._username = value
            self._handler = None
389755
def assert_strong_password(username, password, old_password=None):
    """"""

    # test the length
    try:
        minlength = settings.MIN_PASSWORD_LENGTH
    except AttributeError:
        minlength = 12
    if len(password) < minlength:
        raise ValueError(
            "Password must be at least %s characters long" % minlength)

    if username is not None and username in password:
        raise ValueError("Password contains username")

    return _assert_password(password, old_password)
698835
def username_or(user, attr):
    
    if not settings.ACCOUNTS_NO_USERNAME:
        attr = "username"
    value = getattr(user, attr)
    if callable(value):
        value = value()
    return value