feat: cancel 2fa api
This commit is contained in:
@ -64,6 +64,9 @@ func UpdateUser(c *gin.Context) {
|
||||
if req.Password == "" {
|
||||
req.Password = user.Password
|
||||
}
|
||||
if req.OtpSecret == "" {
|
||||
req.OtpSecret = user.OtpSecret
|
||||
}
|
||||
if err := db.UpdateUser(&req); err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
} else {
|
||||
@ -99,3 +102,17 @@ func GetUser(c *gin.Context) {
|
||||
}
|
||||
common.SuccessResp(c, user)
|
||||
}
|
||||
|
||||
func Cancel2FAById(c *gin.Context) {
|
||||
idStr := c.Query("id")
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
if err := db.Cancel2FAById(uint(id)); err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
return
|
||||
}
|
||||
common.SuccessResp(c)
|
||||
}
|
||||
|
Reference in New Issue
Block a user