Documentation ¶
Index ¶
- Variables
- func CheckEmailExists(email string) (bool, error)
- func CheckPassword(username, password string) (int, error)
- func CheckPwd(password, hash string) error
- func CheckUserNameExists(username string) (bool, error)
- func EmailChangeNotify(email string, timestamp time.Time)
- func GenerateJwt(userId int, clientIp string) (string, error)
- func GeneratePwd(password string) (string, error)
- func GetJwtFromAuth(Authorization string) string
- func PasswordChangeNotify(email string, timestamp time.Time)
- func RegisterCheck(username, email string) error
- func SetJwtExpire(c context.Context, _jwt string) error
- type JwtClaims
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckEmailExists ¶
CheckEmailExists @description Check email if exists in database
func CheckPassword ¶
CheckPassword @description 验证用户登录 if return < 0 error, pwd error or server error if return > 0 success, return user id
func CheckUserNameExists ¶
CheckUserNameExists @description Check username if exists in database
func EmailChangeNotify ¶
func GenerateJwt ¶
GenerateJwt @description generate JWT token for user
func GetJwtFromAuth ¶
GetJwtFromAuth 从 Authorization 中获取JWT
func PasswordChangeNotify ¶
func RegisterCheck ¶
RegisterCheck @description Check users email or user if already exists
Types ¶
type JwtClaims ¶
type JwtClaims struct { ID string `json:"jti,omitempty"` ExpireAt int64 `json:"exp,omitempty"` IssuedAt int64 `json:"iat,omitempty"` Issuer string `json:"iss,omitempty"` Username string `json:"username"` UserId int `json:"userId"` Email string `json:"email"` LastTime int64 `json:"lastTime"` jwt.RegisteredClaims }
Click to show internal directories.
Click to hide internal directories.