更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -15,21 +15,6 @@ import (
|
||||
"github.com/beego/beego/v2/server/web/context"
|
||||
)
|
||||
|
||||
// 模块套餐鉴权(PlanAuth)
|
||||
//
|
||||
// 把「接口前缀」映射到「功能模块编码」(yz_system_modules.code),
|
||||
// 当前租户生效套餐(含已开通的单品订单)未包含该模块时拒绝访问。
|
||||
//
|
||||
// 与 JWT 鉴权一致支持三档模式(app.conf: plan_enforce):
|
||||
// - off :完全不启用
|
||||
// - warn:观察模式,只记录「本会被拦截」的请求(默认,便于上线前核对映射)
|
||||
// - on :真正拦截,未开通返回 403
|
||||
//
|
||||
// 映射表(app.conf: plan_module_paths)示例:
|
||||
// plan_module_paths = /backend/crm:crm,/backend/erp:erp,/backend/oa:oa
|
||||
// 按最长前缀匹配;未出现在映射表中的接口不做模块校验(默认放行),
|
||||
// 因此可以按模块逐个灰度开启,不会误伤用户/角色/文件/日志等通用接口。
|
||||
|
||||
const planMappingSeparator = ":"
|
||||
|
||||
var (
|
||||
@@ -41,7 +26,6 @@ var (
|
||||
planRoutes []planRoute
|
||||
)
|
||||
|
||||
// planRoute 接口前缀 → 模块编码
|
||||
type planRoute struct {
|
||||
prefix string
|
||||
module string
|
||||
@@ -76,7 +60,6 @@ func planInit() {
|
||||
planRoutes = append(planRoutes, planRoute{prefix: prefix, module: module})
|
||||
}
|
||||
|
||||
// 最长前缀优先:/backend/crm/bidding 必须先于 /backend/crm 命中
|
||||
sort.Slice(planRoutes, func(i, j int) bool {
|
||||
return len(planRoutes[i].prefix) > len(planRoutes[j].prefix)
|
||||
})
|
||||
@@ -84,7 +67,6 @@ func planInit() {
|
||||
})
|
||||
}
|
||||
|
||||
// planModuleOf 返回路径归属的模块编码;未配置归属时返回空字符串
|
||||
func planModuleOf(path string) string {
|
||||
for _, r := range planRoutes {
|
||||
if strings.HasPrefix(path, r.prefix) {
|
||||
@@ -94,7 +76,6 @@ func planModuleOf(path string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// PlanAuthMiddleware 模块套餐鉴权中间件
|
||||
func PlanAuthMiddleware() beego.FilterFunc {
|
||||
return func(ctx *context.Context) {
|
||||
planInit()
|
||||
@@ -117,7 +98,6 @@ func PlanAuthMiddleware() beego.FilterFunc {
|
||||
|
||||
claims, err := planClaims(ctx)
|
||||
if err != nil {
|
||||
// 未登录 / 令牌无效:交给 JWTAuthMiddleware 与各控制器按原逻辑处理
|
||||
return
|
||||
}
|
||||
if claims.TenantId <= 0 {
|
||||
@@ -141,7 +121,6 @@ func PlanAuthMiddleware() beego.FilterFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// planClaims 解析 Authorization 头中的 JWT(仅用于本中间件的模块归属判断)
|
||||
func planClaims(ctx *context.Context) (*jwtutil.Claims, error) {
|
||||
authHeader := ctx.Request.Header.Get("Authorization")
|
||||
if authHeader == "" {
|
||||
|
||||
Reference in new issue
Block a user