Skip to content

Instantly share code, notes, and snippets.

Created March 18, 2015 23:58
What would you like to do?
func LoginCookie(username string) http.Cookie {
cookieValue := username + ":" + codify.SHA(username+strconv.Itoa(rand.Intn(100000000)))
expire := time.Now().AddDate(0, 0, 1)
return http.Cookie{Name: "SessionID", Value: cookieValue, Expires: expire, HttpOnly: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment