Documentation ¶
Index ¶
- func CreateUser(username, password string) error
- func GenerateTag() string
- func GetOrSetTag(w http.ResponseWriter, r *http.Request) string
- func GetSavedSession(sessionKey string) (s *data.Session, err error)
- func GetSession(r *http.Request) (*data.Session, error)
- func GetTag(r *http.Request) string
- func Logout(w http.ResponseWriter, r *http.Request, s *data.Session)
- func MustGetSession(r *http.Request) (*data.Session, error)
- func NewSession(user *data.User, expires time.Time, ipAddress, userAgent string) (*data.Session, error)
- func SetSessionCookie(w http.ResponseWriter, r *http.Request, u *data.User, rememberMe bool) error
- func SetTagCookie(w http.ResponseWriter, r *http.Request) string
- func UserLogin(username, password string) (*data.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser saves a new user with the given password. The user's password is processed by SHA-512 then bcrypt.
func GenerateTag ¶
func GenerateTag() string
func GetOrSetTag ¶
func GetOrSetTag(w http.ResponseWriter, r *http.Request) string
GetOrSetTag will get an existing tag or create a new one
func GetSavedSession ¶
GetSavedSession retrieves a session from the database
func GetSession ¶
GetSession searches the request's cookies for the user's session
func MustGetSession ¶
MustGetSession returns an error if GetSession does not find a user session
func NewSession ¶
func NewSession(user *data.User, expires time.Time, ipAddress, userAgent string) (*data.Session, error)
NewSession generates a new session for the user
func SetSessionCookie ¶
SetSessionCookie saves the session cookie to the user's browser
func SetTagCookie ¶
func SetTagCookie(w http.ResponseWriter, r *http.Request) string
SetTagCookie assigns the browser a unique ID that persists across connections
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.