Browse Source

#1573

fix bug
tags/v1.22.2.2^2
chenyifan01 3 years ago
parent
commit
e36e20bf40
3 changed files with 17 additions and 1 deletions
  1. +15
    -0
      modules/context/context.go
  2. +1
    -0
      routers/repo/modelarts.go
  3. +1
    -1
      routers/routes/routes.go

+ 15
- 0
modules/context/context.go View File

@@ -354,3 +354,18 @@ func Contexter() macaron.Handler {
c.Map(ctx)
}
}

// CheckWechatBind
func (ctx *Context) CheckWechatBind() {
if !setting.WechatAuthSwitch {
return
}
redirectUrl := ctx.Query("redirect_to")
if redirectUrl == "" {
redirectUrl = ctx.Req.URL.RequestURI()
}
ctx.SetCookie("redirect_to", setting.AppSubURL+redirectUrl, 0, setting.AppSubURL)
ctx.JSON(200, map[string]string{
"WechatRedirectUrl": setting.AppSubURL + "/authentication/wechat/bind",
})
}

+ 1
- 0
routers/repo/modelarts.go View File

@@ -344,6 +344,7 @@ func NotebookManage(ctx *context.Context) {
break
}
} else if action == models.ActionRestart {
ctx.CheckWechatBind()
if task.Status != string(models.ModelArtsStopped) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsCreateFailed) {
log.Error("the job(%s) is not stopped", task.JobName, ctx.Data["MsgID"])
resultCode = "-1"


+ 1
- 1
routers/routes/routes.go View File

@@ -1061,7 +1061,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/:jobid", func() {
m.Get("", reqRepoCloudBrainReader, repo.NotebookShow)
m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug2)
m.Post("/:action", reqWechatBindForApi, reqRepoCloudBrainWriter, repo.NotebookManage)
m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel)
})
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, repo.NotebookNew)


Loading…
Cancel
Save