You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user.go
    path of file: ./repos/gaia/store
    
    the code of the file until where you have to start completion: package store

import (
	"encoding/json"
	"time"

	bolt "go.etcd.io/bbolt"
	"golang.org/x/crypto/bcrypt"

	"github.com/gaia-pipeline/gaia"
)

// UserPut takes the given user and saves it
// to the bolt database. User will be overwritten
// if it already exists.
// It also clears the password field afterwards.
func (s *BoltStore) UserPut(u *gaia.User, encryptPassword bool) error {
	/
    
func (s *BoltStore) UserAuth(u *gaia.User, updateLastLogin bool) (*gaia.User, error) {
	// Look up user
	user, err := s.UserGet(u.Username)

	// Error occurred and/or user not found
	if err != nil || user == nil {
		return nil, err
	}

	// Check if password is valid
	if err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(u.Password)); err != nil {
		return nil, err
	}

	// Update last login field
	if updateLastLogin {
		user.LastLogin = time.Now()
		err = s.UserPut(user, false)
		if err != nil {
			return nil, err
		}
	}

	// We will use the user object later.
	// But we don't need the password anymore.
	user.Password = ""

	// Return user
	return user, nil
}