commonService

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ExpiresAt time.Duration = 90 * 24 * time.Hour

Variables

View Source
var Common = new(common)
View Source
var GroupApp = new(Group)

Functions

This section is empty.

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (*Group) CheckCaptchaStatus

func (cm *Group) CheckCaptchaStatus(key string) bool

CheckCaptchaStatus 判断验证码是否开启

func (*Group) CheckEmailCaptcha

func (cm *Group) CheckEmailCaptcha(email string, captcha string) error

检查邮件验证码错误次数 如果该邮件验证码错误次数过多 则短时禁用该邮件以保护该邮件

func (*Group) GenerateJWT

func (cm *Group) GenerateJWT(custom jwt.RegisteredClaims) (string, error)

func (*Group) HashPassword

func (cm *Group) HashPassword(username string, password string) string

func (*Group) MakeCustomClaims

func (cm *Group) MakeCustomClaims(userId uint) jwt.RegisteredClaims

func (*Group) ParseToken

func (cm *Group) ParseToken(tokenStr string) (jwt.RegisteredClaims, error)

func (*Group) RefreshJWT

func (cm *Group) RefreshJWT(custom jwt.RegisteredClaims) (token string, newCustom jwt.RegisteredClaims, err error)

func (*Group) SetEmailCaptchaCache

func (cm *Group) SetEmailCaptchaCache(email string, emailCaptcha string, expirationTime time.Duration) error

设置邮件验证码缓存 如果该缓存已存在未过期 则返回ErrOperationTooFrequent 以此避免重复发送和频繁操作

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL