Documentation ¶
Index ¶
- Variables
- func Encrypt(inputStr string, key string, iv string) (string, error)
- func GetCurrentDirectory() string
- func GetDomain(host string) string
- func GetIP(r *http.Request) string
- func GetUserId(r *http.Request) string
- func Init(resource *crud.Resource, r *gin.Engine)
- func RemoveUserSession(resource *crud.Resource, request *http.Request, writer gin.ResponseWriter)
- type UserSession
Constants ¶
This section is empty.
Variables ¶
View Source
var ChemballUserKey = "c_u"
View Source
var MaxAge int
View Source
var SidKey = "sid"
Functions ¶
func Encrypt ¶ added in v1.230620.2
Encrypt encrypts the input string using AES-128 CBC mode with PKCS7 padding. The key and iv must be 16 bytes long.
func RemoveUserSession ¶ added in v1.0.9
退出登录
Types ¶
type UserSession ¶
type UserSession struct { base.BaseId `bson,inline` Uid string `bson:"uid" json:"uid"` Expires *time.Time `bson:"expires,omitempty" json:"expires,omitempty"` Agent string `bson:"agent,omitempty" json:"agent,omitempty"` Ip string `bson:"ip,omitempty" json:"ip,omitempty"` // login、logout Status string `bson:"status" json:"status"` // 邮箱 Email string `bson:"email" json:"email"` // 头像 Avatar string `bson:"avatar" json:"avatar"` NickName string `bson:"nickName" json:"nickName"` MaxAge int64 `bson:"-"` }
用户session模型
func NewUserSession ¶
func NewUserSession(resource *crud.Resource, userSession UserSession, r *http.Request, w http.ResponseWriter) (*UserSession, string)
Click to show internal directories.
Click to hide internal directories.