Exemple #1
0
// 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
}
Exemple #2
0
func GetUserIdFromSession(sess session.SessionStore) int {
	if id, ok := sess.Get("auth_user_id").(int); ok && id > 0 {
		return id
	}
	return 0
}