sessions

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MaxAge = 60 * 60 * 24 * 365 * 5

Variables

This section is empty.

Functions

func IsValidCSRF

func IsValidCSRF(r *http.Request) bool

func SaveCaptcha

func SaveCaptcha(w http.ResponseWriter, r *http.Request) *http.Request

func SaveCsrf

func SaveCsrf(w http.ResponseWriter, r *http.Request) *http.Request

func Set

Types

type Data

type Data struct {
	TimeoutAt time.Time    `json:",omitempty"`
	USER      string       `json:",omitempty"`
	LastSeen  time.Time    `json:",omitempty"`
	LoggedIn  bool         `json:",omitempty"`
	Captcha   string       `json:",omitempty"`
	Csrf      string       `json:",omitempty"`
	LoginDest string       `json:",omitempty"`
	Flash     *flash.Flash `json:",omitempty"`
}

type Session

type Session string

func Get

func Get(ctx context.Context) Session

func NewSession

func NewSession(name string) Session

func (*Session) Create

func (s *Session) Create(ctx context.Context, b []byte) string

func (*Session) Get

func (s *Session) Get(ctx context.Context, value string) []byte

func (Session) Load

func (s Session) Load(r *http.Request) (*SessionContext, *http.Request)

type SessionContext

type SessionContext struct {
	Data Data
	// contains filtered or unexported fields
}

func Load

func Load(r *http.Request) (*SessionContext, *http.Request)

func (*SessionContext) CustomFlash added in v0.0.13

func (s *SessionContext) CustomFlash(m string) *SessionContext

func (*SessionContext) FailFlash

func (s *SessionContext) FailFlash(m string) *SessionContext

func (*SessionContext) Save

func (*SessionContext) SuccessFlash

func (s *SessionContext) SuccessFlash(m string) *SessionContext

func (*SessionContext) VerifyCaptchaSolution

func (s *SessionContext) VerifyCaptchaSolution(r *http.Request) bool

Jump to

Keyboard shortcuts

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