jiangshuai
2024-02-06 84d2953e7b641600779e7aecc80bdd35e96d31d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package middleware
 
import (
    "github.com/gin-gonic/gin"
    "srm/pkg/contextx"
    "srm/pkg/ecode"
    "srm/request"
)
 
func VerifyResetPwd() gin.HandlerFunc {
    return func(c *gin.Context) {
        ctx := new(contextx.Context).SetCtx(c)
        params, ok := c.Get("claims")
        if !ok {
            c.Abort()
            return
        }
        claims := params.(*request.CustomClaims)
        if !claims.ModifiedPwd {
            ctx.Fail(ecode.ResetPwd)
            c.Abort()
            return
        }
    }
}