util

package
v0.0.0-...-75ff7da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_NAME = "default-session"
)

Variables

View Source
var FLASH_KEYS = []string{
	"invalid_login",
	"username_taken",
	"email_taken",
	"signup_username",
	"signup_email",
	"show_login",
	"show_signup",
	"email_confirmed",
}

Functions

func GenerateHashKey

func GenerateHashKey() (string, error)

func ParseTemplates

func ParseTemplates(templates map[string]*template.Template, templatePaths map[string]string)

Types

type CookieJar

type CookieJar struct {
	// contains filtered or unexported fields
}

func NewCookieJar

func NewCookieJar(w http.ResponseWriter, r *http.Request, config *ServerConfig) *CookieJar

func (*CookieJar) Authenticate

func (cj *CookieJar) Authenticate(dbc *db.Database) (db.Account, db.AccountSession, bool)

func (CookieJar) ClearCookie

func (cj CookieJar) ClearCookie(name string)

func (CookieJar) ClearSessionKey

func (cj CookieJar) ClearSessionKey()

func (CookieJar) GetSessionKey

func (cj CookieJar) GetSessionKey() string

func (CookieJar) ParseFlashes

func (cj CookieJar) ParseFlashes() map[string]string

func (*CookieJar) SaveSession

func (cj *CookieJar) SaveSession()

This should be called before writing the response, as it needs to set the cookies in the header.

func (CookieJar) SetEmailConfirmed

func (cj CookieJar) SetEmailConfirmed()

func (CookieJar) SetEmailTaken

func (cj CookieJar) SetEmailTaken()

func (CookieJar) SetIsInvalidLogin

func (cj CookieJar) SetIsInvalidLogin()

func (CookieJar) SetSessionKey

func (cj CookieJar) SetSessionKey(key string)

func (CookieJar) SetSignupFormVals

func (cj CookieJar) SetSignupFormVals(username string, email string)

func (CookieJar) SetUsernameTaken

func (cj CookieJar) SetUsernameTaken()

type ServerConfig

type ServerConfig struct {
	Host           string
	WwwPort        string
	ServerPort     string
	ClientAssets   string
	PersistEnabled bool
	WorldBaseDir   string
	DbPass         string
	MailPass       string
	CookieDomain   string
	CookieSecure   bool
	CookieKeyPairs [][]byte
}

func LoadServerConfig

func LoadServerConfig(path string) *ServerConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL