Exemple #1
0
func Logout(session sessions.Session, r render.Render, dbh *db.Dbh) {
	sessionkey := session.Get("key")
	uid := session.Get("uid")

	session.Set("loggedin", "false")
	session.Set("uid", nil)
	session.Set("email", nil)
	session.Set("key", nil)

	if uid != "" && uid != nil {
		dbh.DestroySession(uid.(int64), sessionkey.(string))
	}
	r.Redirect(utils.AppCfg.Url(), http.StatusFound)
}