From 2be45b1f52b48ba3b33b2906f4e380ed97fc9821 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 26 Jan 2022 11:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/user/auth.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routers/user/auth.go b/routers/user/auth.go index 16af84b66..b4953beb3 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -143,6 +143,7 @@ func SignIn(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("sign_in") ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login" ctx.Data["PageIsSignIn"] = true + ctx.Data["IsCourse"] = ctx.QueryBool("course") ctx.Data["PageIsLogin"] = true ctx.Data["EnableSSPI"] = models.IsSSPIEnabled() ctx.Data["EnableCloudBrain"] = true @@ -565,6 +566,12 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR return setting.AppSubURL + "/dashboard" } + isCourse := ctx.QueryBool("course") + if isCourse { + redirectToCourse := setting.AppSubURL + "/" + setting.Course.OrgName + ctx.RedirectToFirst(redirectToCourse) + return redirectToCourse + } if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) if obeyRedirect {