mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
feat(cli): reset init user password
This commit is contained in:
parent
c56af25671
commit
d1d13b620f
5 changed files with 113 additions and 2 deletions
|
@ -3,6 +3,7 @@ package user
|
|||
import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/user"
|
||||
"github.com/0xJacky/Nginx-UI/model"
|
||||
"github.com/0xJacky/Nginx-UI/query"
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/uozi-tech/cosy"
|
||||
|
@ -40,6 +41,12 @@ func InitManageUserRouter(g *gin.RouterGroup) {
|
|||
}
|
||||
})
|
||||
c.BeforeDecodeHook(encryptPassword)
|
||||
c.ExecutedHook(func(ctx *cosy.Ctx[model.User]) {
|
||||
if ctx.Payload["password"] != "" {
|
||||
a := query.AuthToken
|
||||
_, _ = a.Where(a.UserID.Eq(ctx.ID)).Delete()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
c.DestroyHook(func(c *cosy.Ctx[model.User]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue