Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultSessionDurationDay = 7 // No. of days login session will last
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LicenseExpiredError ¶
type LicenseExpiredError struct{}
func (LicenseExpiredError) Error ¶
func (l LicenseExpiredError) Error() string
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
func InitSessionService ¶
func InitSessionService(userService *user.UserService, db *gorm.DB) *SessionService
func (*SessionService) CreateUserSession ¶
func (a *SessionService) CreateUserSession(ctx context.Context, email string, password string) (*user.User, string, int64, error)
Verifies user email and password, then generates session for user, returning the user object, session token, and time of expiry
func (*SessionService) DeleteSession ¶
func (a *SessionService) DeleteSession(session Session) error
Delete session from cache and DB
func (*SessionService) GetSessionByToken ¶
func (a *SessionService) GetSessionByToken(token string) (*user.User, error)
Retrieves session user from token. If session is expired, deletes session and returns error
type UserNotVerifiedError ¶
type UserNotVerifiedError struct { }
func (UserNotVerifiedError) Error ¶
func (u UserNotVerifiedError) Error() string
Click to show internal directories.
Click to hide internal directories.