// get user if key exist in session func GetUserFromSession(user *User, sess session.SessionStore) bool { if id, ok := sess.Get("auth_user_id").(int64); ok && id > 0 { *user = User{Id: id} if user.Read() == nil { return true } } return false }
func GetUserIdFromSession(sess session.SessionStore) int { if id, ok := sess.Get("auth_user_id").(int); ok && id > 0 { return id } return 0 }