Documentation ¶
Overview ¶
The package manages user login sessions
Index ¶
- func Init()
- type ActiveSessions
- type ErrorsList
- type LoginDetails
- type LoginSession
- type UserModel
- type UserSessions
- func (us *UserSessions) GetUserId(un string) (int, error)
- func (us *UserSessions) LogIn(req LoginDetails) (LoginSession, error)
- func (us *UserSessions) LogOut(session LoginSession)
- func (us *UserSessions) SetUserDataHandle(ud iUserDataStorage)
- func (us *UserSessions) SignUp(un, pwd, email string, validationErrors ErrorsList) error
- func (us *UserSessions) VerifyLoginSession(session LoginSession) bool
- type UserSessionsErrors
- type UserSessionsLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveSessions ¶
ActiveSessions stores the list of all the active login sessions associated with a particular user
type ErrorsList ¶
type LoginDetails ¶
type LoginSession ¶
LoginSession stores the details of a login session
type UserSessions ¶
type UserSessions struct { Errors *UserSessionsErrors // contains filtered or unexported fields }
UserSessions serves the user login session requests from the outside modules
func GetUserSessionsInstance ¶
func GetUserSessionsInstance() *UserSessions
func (*UserSessions) GetUserId ¶
func (us *UserSessions) GetUserId(un string) (int, error)
getUserId() returns the id of a user
func (*UserSessions) LogIn ¶
func (us *UserSessions) LogIn(req LoginDetails) (LoginSession, error)
LogIn() verify the user account credentials and (if successfull) create a login session.
func (*UserSessions) LogOut ¶
func (us *UserSessions) LogOut(session LoginSession)
LogOut() destroy the user login session
func (*UserSessions) SetUserDataHandle ¶
func (us *UserSessions) SetUserDataHandle(ud iUserDataStorage)
Set the handler for the UserData interface. This function is used during the initialization of the UserSessionsInst singleton and it should not allow re-assigning the interface handle from other modules.
func (*UserSessions) SignUp ¶
func (us *UserSessions) SignUp(un, pwd, email string, validationErrors ErrorsList) error
SignUp() Validates the user input and creates a new user entry in the user data storage. If any validation errors occur, no entries are creates and the the validationErrors variable is populated accordingly with all the error messages. If a non-validation error occurs, the function returns it. func (us *UserSessions) SignUp(un, pwd, email string, validationErrors ErrorsList) error {
func (*UserSessions) VerifyLoginSession ¶
func (us *UserSessions) VerifyLoginSession(session LoginSession) bool
VerifyLoginSession verify the user login session info
type UserSessionsErrors ¶
type UserSessionsLogger ¶
type UserSessionsLogger struct {
// contains filtered or unexported fields
}
func GetLogger ¶
func GetLogger() *UserSessionsLogger
func (*UserSessionsLogger) SetErrorLogger ¶
func (l *UserSessionsLogger) SetErrorLogger(logger *log.Logger)
func (*UserSessionsLogger) SetInfoLogger ¶
func (l *UserSessionsLogger) SetInfoLogger(logger *log.Logger)