add models / services / handlers of user / token / 2fa, add web server command

This commit is contained in:
MaysWind
2020-10-17 20:01:24 +08:00
parent c9ae001aef
commit 60c31e8894
18 changed files with 1649 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
package models
type TwoFactor struct {
Uid int64 `xorm:"PK"`
Secret string `xorm:"VARCHAR(80) NOT NULL"`
CreatedUnixTime int64
}
type TwoFactorLoginRequest struct {
Passcode string `json:"passcode" binding:"required,notBlank,len=6"`
}
type TwoFactorEnableConfirmRequest struct {
Secret string `json:"secret" binding:"required,notBlank,len=32"`
Passcode string `json:"passcode" binding:"required,notBlank,len=6"`
}
type TwoFactorEnableResponse struct {
Secret string `json:"secret"`
QRCode string `json:"qrcode"`
}
type TwoFactorEnableConfirmResponse struct {
Token string `json:"token,omitempty"`
RecoveryCodes []string `json:"recoveryCodes"`
}
type TwoFactorStatusResponse struct {
Enable bool `json:"enable"`
CreatedAt int64 `json:"createdAt,omitempty"`
}