<commit_before>package main

import (
	"github.com/stealthycoin/rhynock"
	"net/http"
)

// Super amazing database of users
var (
	people = map[string]string{
		"Steve": "<PASSWORD>",
		"Joe": "<PASSWORD>",
		"Anna": "hunter2",
	}
)


// Profile object to keep track of login status
type Profile struct {
	authed bool // Is this person authenticated yet?
	name string // Who is this person?
}

type Router struct {
	// Do a decent job keeping track of who is logged in
	connections map[*rhynock.Conn]*Profile

	// Channel to recieve bottles through
	bottle     chan *rhynock.Bottle
}


// Satisfy the BottleDst interface
func (r *Router) GetBottleChan() (chan *rhynock.Bottle) {
	return r.bottle
}

// Satisfy the BottleDst interface
func (r *Router) ConnectionClosed(c *rhynock.Conn) {
	delete(r.connections, c)
}

// Satisfy the BottleDst interface
func (r *Router) ConnectionOpened(c *rhynock.Conn) {
	// Create an empty profile for them
	r.connections[c] = &Profile{}

	// Send them a login prompt
	c.Send("Enter your username")
}

// Function to manage login process
func (r *Router) login(b *rhynock.Bottle) {
	// For ease of use
	profile := r.connections[b.Sender]

	// Is the message a username or a password?
	// Username comes first so check if its empty
	if profile.name == "" {
		// Dont know their name yet so this message should be their name
		profile.name = string(b.Message)

		// Now tell them to enter their password
		b.Sender.Send("Enter password")
	} else {

		// Their name is set so this is their password
		// Check our super super database to see if they
		// authenticated correctly
		pass := string(b.Message)
		if db_pass, ok := people[profile.name]; ok {
			// The name was in the list now lets check their password
			if pass == db_pass {
				// Huzzah they logged in successfully
				profile.authed = true

				// Alert them they are logged in
				b.Sender.Send("Logged in as " + profile.name)
			} else {
				// They typed the password wrong
				b.Sender.CloseMsg("Invalid password.")
			}
		} else {
			// The name wasn't in the list so they fail
			b.Sender.CloseMsg("Invalid username.")
		}
	}
}

func main() {
	router := &Router{
		connections: make(map[*rhynock.Conn]*Profile),<commit_msg>User better name<commit_after>package main

import (
	"github.com/stealthycoin/rhynock"
	"net/http"
)

// Super amazing database of users
var (
	people = map[string]string{
		"Steve": "<PASSWORD>",
		"Joe": "<PASSWORD>",
		"Anna": "hunter2",
	}
)


// Profile object to keep track of login status
type Profile struct {
	authed bool // Is this person authenticated yet?
	name string // Who is this person?
}

type Router struct {
	// Do a decent job keeping track of who is logged in
	connections map[*rhynock.Conn]*Profile

	// Channel to recieve bottles through
	bottle     chan *rhynock.Bottle
}


// Satisfy the BottleDst interface
func (r *Router) GetBottleChan() (chan *rhynock.Bottle) {
	return r.bottle
}

// Satisfy the BottleDst interface
func (r *Router) ConnectionClosed(c *rhynock.Conn) {
	delete(r.connections, c)
}

// Satisfy the BottleDst interface
func (r *Router) ConnectionOpened(c *rhynock.Conn) {
	// Create an empty profile for them
	r.connections[c] = &Profile{}

	// Send them a login prompt
	c.SendMsg("Enter your username")
}

// Function to manage login process
func (r *Router) login(b *rhynock.Bottle) {
	// For ease of use
	profile := r.connections[b.Sender]

	// Is the message a username or a password?
	// Username comes first so check if its empty
	if profile.name == "" {
		// Dont know their name yet so this message should be their name
		profile.name = string(b.Message)

		// Now tell them to enter their password
		b.Sender.SendMsg("Enter password")
	} else {

		// Their name is set so this is their password
		// Check our super super database to see if they
		// authenticated correctly
		pass := string(b.Message)
		if db_pass, ok := people[profile.name]; ok {
			// The name was in the list now lets check their password
			if pass == db_pass {
				// Huzzah they logged in successfully
				profile.authed = true

				// Alert them they are logged in
				b.Sender.SendMsg("Logged in as " + profile.name)
			} else {
				// They typed the password wrong
				b.Sender.CloseMsg("Invalid password.")
			}
		} else {
			// The name wasn't in the list so they fail
			b.Sender.CloseMsg("Invalid username.")
		}
	}
}

func main() {
	router := &Router{
		connections: make(map[*rhynock.Conn]*Profile),
{'fraction_non_alphanumeric': 0.11200716845878136, 'fraction_numerical': 0.00044802867383512545, 'mean_word_length': 3.2402659069325734, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4803975', 'n_tokens_mistral': 1572, 'n_tokens_neox': 1425, 'n_words': 515}