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