<commit_before>package gitnotify

import (
	"encoding/gob"
	"os"

	"github.com/gorilla/sessions"
	"github.com/markbates/goth/gothic"
	"github.com/sairam/kinli"
)

const (
	userInfoProvider = "provider"
	userInfoName     = "name"
	userInfoEmail    = "email"
	userInfoUser     = "user"
	userInfoToken    = "token"

	loginFlash = "Login to customize settings"
)

// InitSession registers and everything related to the user's session
func InitSession() {
	gob.Register(&Authentication{})
	kinli.SessionName = "_git_notify"
	kinli.HomePathNonAuthed = "/home"
	kinli.HomePathAuthed = "/"

	var store = sessions.NewFilesystemStore("./sessions", []byte(os.Getenv("SESSION_FS_STORE")))
	// TODO mark session as httpOnly, secure
	// http://www.gorillatoolkit.org/pkg/sessions#Options
	store.Options = &sessions.Options{
		Path: "/",
		// Domain:   config.serverHostWithoutPort(),  // take from config
		MaxAge:   86400 * 30,                      // 30 days
		HttpOnly: true,                            // to avoid cookie stealing and session is on server side
		Secure:   (config.ServerProto == "https"), // for https
	}

	kinli.SessionStore = store

	// init Gothic
	gothic.Store = store
	gothic.GetProviderName = getProviderName

}

// TODO use gob for encoding. See example here - http://www.gorillatoolkit.org/pkg/sessions

func loginTheUser(hc *kinli.HttpContext, userInfo *Authentication, provider string) {<commit_msg>update sessionname to ignore old info<commit_after>package gitnotify

import (
	"encoding/gob"
	"os"

	"github.com/gorilla/sessions"
	"github.com/markbates/goth/gothic"
	"github.com/sairam/kinli"
)

const (
	userInfoProvider = "provider"
	userInfoName     = "name"
	userInfoEmail    = "email"
	userInfoUser     = "user"
	userInfoToken    = "<PASSWORD>"

	loginFlash = "Login to customize settings"
)

// InitSession registers and everything related to the user's session
func InitSession() {
	gob.Register(&Authentication{})
	kinli.SessionName = "_git_notify1"
	kinli.HomePathNonAuthed = "/home"
	kinli.HomePathAuthed = "/"

	var store = sessions.NewFilesystemStore("./sessions", []byte(os.Getenv("SESSION_FS_STORE")))
	// TODO mark session as httpOnly, secure
	// http://www.gorillatoolkit.org/pkg/sessions#Options
	store.Options = &sessions.Options{
		Path: "/",
		// Domain:   config.serverHostWithoutPort(),  // take from config
		MaxAge:   86400 * 30,                      // 30 days
		HttpOnly: true,                            // to avoid cookie stealing and session is on server side
		Secure:   (config.ServerProto == "https"), // for https
	}

	kinli.SessionStore = store

	// init Gothic
	gothic.Store = store
	gothic.GetProviderName = getProviderName

}

// TODO use gob for encoding. See example here - http://www.gorillatoolkit.org/pkg/sessions

func loginTheUser(hc *kinli.HttpContext, userInfo *Authentication, provider string) {
{'fraction_non_alphanumeric': 0.12027972027972028, 'fraction_numerical': 0.006643356643356644, 'mean_word_length': 3.428792569659443, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '3694833', 'n_tokens_mistral': 975, 'n_tokens_neox': 922, 'n_words': 217}