Versions in this module Expand all Collapse all v1 v1.3.0 Oct 23, 2023 Changes in this version + var ErrAPICreatePassword = errors.New("error during create password") + var ErrAPICreateSession = errors.New("create session") + var ErrAPIIncorrectPassword = errors.New("incorrect password") + var ErrAPINoPermission = errors.New("error on access an object") + var ErrAPINoSession = errors.New("no session") + var ErrAPIUserNotFound = errors.New("user not found") + var PasswordHashCost = bcrypt.DefaultCost + func GetCurrentUserID(c *gin.Context) (uuid.UUID, bool) + func HashPassword(password string) (string, error) + func IsLoginWithUserID(c *gin.Context) (uuid.UUID, bool) + func MiddlewareLogin(ws *web.Service) gin.HandlerFunc + func MiddlewarePermissionParam(ws *web.Service, obj HasPermission, param string) gin.HandlerFunc + func MiddlewarePermissionParamUUID(ws *web.Service, obj HasPermission) gin.HandlerFunc + func Register(r *gin.Engine, ws *web.Service) + func ValidatePassword(hash, password string) bool + type HasPermission interface + HasPermission func(tx *gorm.DB, userID, objID uuid.UUID) (interface{}, error) + type PasswordWithForgetCode struct + ForgetCode uuid.UUID + Password string + type User struct + ForgetCode *uuid.UUID + ID uuid.UUID + Password string + Username string + func GetCurrentUser(c *gin.Context, ws *web.Service) (*User, bool) + func NewUser(username, password string) (*User, error) + func (u *User) SetPassword(password string) error + func (u *User) ValidatePassword(password string) bool