code

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//验证码
	SmsCodeGetParamsInvalidMsg    string = "获取验证码:提交的验证码参数无效,请检查验证码ID以及文件名后缀是否完整"
	SmsCodeGetParamsInvalidCode   int    = -400350
	SmsCodeCheckParamsInvalidMsg  string = "" /* 127-byte string literal not displayed */
	SmsCodeCheckParamsInvalidCode int    = -400351
	SmsCodeCheckOkMsg             string = "验证码校验通过"
	SmsCodeCheckFailCode          int    = -400355
	SmsCodeCheckFailMsg           string = "验证码校验失败"
)

Variables

This section is empty.

Functions

func Init

func Init()

Types

type PhoneForm

type PhoneForm struct {
	Phone string `form:"phone"`
	Code  string `form:"code"`
	Scene string `form:"scene"`
}

type SmsCodeController

type SmsCodeController struct {
	controller.ResourceController
	SmsCodeValidator *SmsCodeValidator `inject:"smsCodeValidator"`
}

*

  • Controller

func (*SmsCodeController) CheckCode

func (s *SmsCodeController) CheckCode(c *gin.Context)

func (*SmsCodeController) GenerateCode

func (s *SmsCodeController) GenerateCode(c *gin.Context)

func (*SmsCodeController) InitRouter

func (s *SmsCodeController) InitRouter(g *gin.RouterGroup) *gin.RouterGroup

*

  • 处理WEB验证码的API路由

type SmsCodeSender

type SmsCodeSender struct {
	sms.SmsSender `inject:"smsSender"`
}

func (*SmsCodeSender) SendVerificationCode

func (s *SmsCodeSender) SendVerificationCode(dest string, scene string, code string) error

type SmsCodeValidator

type SmsCodeValidator struct {
	code.Validator
	Sender code.CodeSender `inject:"smsCodeSender"`
	Store  code.CodeStore  `inject:"smsCodeStore"`
}

*

  • Validator

func (*SmsCodeValidator) GetSender

func (v *SmsCodeValidator) GetSender() code.CodeSender

func (*SmsCodeValidator) GetStore

func (v *SmsCodeValidator) GetStore() code.CodeStore

func (*SmsCodeValidator) HandleSmsCodeVerify

func (v *SmsCodeValidator) HandleSmsCodeVerify(force bool) gin.HandlerFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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