Feat: enable 2FA / password management

This commit is contained in:
HFO4
2020-02-20 12:42:38 +08:00
parent 58d8695c53
commit 80268e33bf
8 changed files with 171 additions and 4 deletions

View File

@@ -257,6 +257,14 @@ func UpdateOption(c *gin.Context) {
subService = &user.VIPUnsubscribe{}
case "qq":
subService = &user.QQBind{}
case "policy":
subService = &user.PolicyChange{}
case "homepage":
subService = &user.HomePage{}
case "password":
subService = &user.PasswordChange{}
case "2fa":
subService = &user.Enable2FA{}
}
subErr = c.ShouldBindJSON(subService)
@@ -272,3 +280,14 @@ func UpdateOption(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// UserInit2FA 初始化二步验证
func UserInit2FA(c *gin.Context) {
var service user.SettingService
if err := c.ShouldBindUri(&service); err == nil {
res := service.Init2FA(c, CurrentUser(c))
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}