session

package
v0.0.0-...-f2f702e Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(s *Session)

Configure Session

func Empty

func Empty(sess *sessions.Session)

Empty deletes all keys and values in the session

func GetFlash

func GetFlash(w http.ResponseWriter, r *http.Request) string

GetFlash returns the value of a flash-message

func GetUserFromSession

func GetUserFromSession(r *http.Request) model.User

GetUserFromSession returns user object stored in session

func Instance

func Instance(r *http.Request) (*sessions.Session, error)

Instance returns an instance of the Session

func IsLoggedIn

func IsLoggedIn(r *http.Request) bool

IsLoggedIn returns if user is authenticated or not

func IsTeacher

func IsTeacher(r *http.Request) bool

IsTeacher returns if user is a teacher or not

func SaveUserToSession

func SaveUserToSession(user model.User, w http.ResponseWriter, r *http.Request) bool

SaveUserToSession saves user object to session store

func SetFlash

func SetFlash(message string, w http.ResponseWriter, r *http.Request) error

SetFlash sets a flash-message

Types

type Session

type Session struct {
	Options   sessions.Options `json:"options"`
	Name      string           `json:"name"`
	SecretKey string           `json:"secretKey"`
}

Session struct

Jump to

Keyboard shortcuts

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