dashboard-v2/utils/sessionutils.go
2019-05-25 23:25:00 +01:00

15 lines
416 B
Go

package utils
import (
"github.com/gin-gonic/contrib/sessions"
"strconv"
)
func IsLoggedIn(store sessions.Session) bool {
return store.Get("access_token") != nil && store.Get("expiry") != nil && store.Get("refresh_token") != nil && store.Get("userid") != nil && store.Get("name") != nil
}
func GetUserId(store sessions.Session) (int64, error) {
return strconv.ParseInt(store.Get("userid").(string), 10, 64)
}