Register for a new account on this HS.

        Args:
            username (str): Account username
            password (str): Account password

        Returns:
            str: Access Token

        Raises:
            MatrixRequestError
7375
def register_with_password(self, username, password):
        
        response = self.api.register(
                auth_body={"type": "m.login.dummy"},
                kind='user',
                username=username,
                password=password,
        )
        return self._post_registration(response)
25097
def add_register_user(
        self, username, first_name, last_name, email, password="", hashed_password=""
    ):
        
        register_user = self.registeruser_model()
        register_user.username = username
        register_user.email = email
        register_user.first_name = first_name
        register_user.last_name = last_name
        if hashed_password:
            register_user.password = hashed_password
        else:
            register_user.password = generate_password_hash(password)
        register_user.registration_hash = str(uuid.uuid1())
        try:
            self.get_session.add(register_user)
            self.get_session.commit()
            return register_user
        except Exception as e:
            log.error(c.LOGMSG_ERR_SEC_ADD_REGISTER_USER.format(str(e)))
            self.appbuilder.get_session.rollback()
            return None
779292
def login():
    
    req = flask.request.get_json(force=True)
    username = req.pop('username', None)
    password = req.pop('password', None)

    user = guard.authenticate(username, password)
    ret = {'access_token': guard.encode_jwt_token(
        user,
        firstname=user.firstname,
        nickname=user.nickname,
        surname=user.surname,
    )}

    return (flask.jsonify(ret), 200)
362142
def basic_register(username, password, password2):
    
    if password != password2:
        raise InvalidInput(password={'message': "Passwords do not match"},
                           username={'value': username})
    user = User.objects.create_user(username, password)
    return create_session(user.username, password)
1365717
def login(username, password)
      params = { grant_type: "password", username: username, password: password }
      response = self['token'].get({ params: params })
      user_uuid = response.data['user']['uuid']
      user_access_token = response.data['access_token']
      Thread.current[:usergrid_user_id] = user_uuid
      Thread.current[:usergrid_auth_token] = user_access_token
      @current_user = self["/users/#{user_uuid}"].get.entity
      response
    end
1248932
def QA_user_sign_up(name, password, client):
    

    coll = client.user
    if (coll.find({'username': name}).count() > 0):
        print(name)
        QA_util_log_info('user name is already exist')
        return False
    else:
        return True
1352581
def basic_auth(self, username, password):
        
        if not (username and password):
            return

        self.auth = (username, password)

        # Disable token authentication
        self.headers.pop('Authorization', None)
1115577
def with_username(username, password):
    
    user = models.AuthUser.get_by_username(username)
    return _user(user) if user and user.password_matched(password) else None
420713
def authenticate(self, provider=None, identifier=None):
        ""
        provider_q = Q(provider__name=provider)
        if isinstance(provider, Provider):
            provider_q = Q(provider=provider)
        try:
            access = AccountAccess.objects.filter(
                provider_q, identifier=identifier
            ).select_related('user')[0]
        except IndexError:
            return None
        else:
            return access.user
324102
def login(self, username, password):
        '''
        '''
        response = self.request(
            ACCESS_TOKEN,
            {
                'x_auth_mode': 'client_auth',
                'x_auth_username': username,
                'x_auth_password': password
            },
            returns_json=False
        )
        token = dict(parse_qsl(response['data'].decode()))
        self.token = oauth.Token(
            token['oauth_token'], token['oauth_token_secret'])
        self.oauth_client = oauth.Client(self.consumer, self.token)
1363012
def authenticate_user(username, password):
    
    user_model = Query()
    user = db.get(user_model.username == username)

    if not user:
        logger.warning("User %s not found", username)
        return False

    if user['password'] == hash_password(password, user.get('salt')):
        return user['username']

    return False
145211
def authenticate_credentials(self, userid, password):
        
        credentials = {
            get_user_model().USERNAME_FIELD: userid,
            'password': password
        }
        user = authenticate(**credentials)

        if user is None:
            raise exceptions.AuthenticationFailed(_('Invalid username/password.'))

        if not user.is_active:
            raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))

        return (user, None)
1109179
def auth_user(self, username, password):
        
        password_hash = hashlib.sha512(password.encode("utf-8")).hexdigest()

        user = self._database.users.find_one(
            {"username": username, "password": password_hash, "activate": {"$exists": False}})

        return user if user is not None and self.connect_user(username, user["realname"], user["email"], user["language"]) else None
708122
def get_account(self, username):
        
        try:
            account = self.model.objects.get(
                **self._filter_user_by(username)
            )
        except self.model.DoesNotExist:
            return None
        return account
734122
def register_by_name_pwd(username, password, nickname = nil)
      token =    self.auth_token()

      result = HTTParty.post("#{@head_url}/users", 
          :body => { :username     => username, 
                     :password     => password, 
                     :nickname     => nickname
                   }.to_json,
          :headers => { 'Content-Type' => 'application/json', 'Authorization'=>"Bearer #{token}" } )
      if result.response.code.to_i == 200
        return [username, password] 
      else
        nil
      end
    end
721076
def login(self, username, password):
        

        data = self._authenticate(
            grant_type='password',
            username=username,
            password=password,
            client_id=self._client_id,
            client_secret=self._client_secret
        )

        self._username = username
        self._password = password

        return data
659284
def subscribe_account(self, username, password, service):
        
        data = {
            'service': service,
            'username': username,
            'password': password,
        }

        return self._perform_post_request(self.subscribe_account_endpoint, data, self.token_header)