Example #1
0
func (handler AuthHandler) createUserSession(r *http.Request, w http.ResponseWriter, user *gu.User) {
	session, err := handler.SessionStore.Get(r, "goth-session")
	if err != nil {
		panic(err)
	}
	session.Values["identifier"] = user.EmailHash()
	session.Save(r, w)
}
Example #2
0
func (store UserGobStore) Save(user user.User) error {
	emailHash := user.EmailHash()
	userGobBuf := new(bytes.Buffer)
	encoder := gob.NewEncoder(userGobBuf)
	encoder.Encode(user)
	return ioutil.WriteFile(store.Path+emailHash+".gob", userGobBuf.Bytes(), 0600)
}