From c2625240c4e44803ce849b5f32830a5097c5187b Mon Sep 17 00:00:00 2001 From: naiba Date: Sat, 30 Apr 2022 21:39:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20imporve=20`redirect`=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/dashboard/controller/oauth2.go | 8 ++++---- resource/template/dashboard/redirect.html | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/dashboard/controller/oauth2.go b/cmd/dashboard/controller/oauth2.go index 38010b5..14a5a93 100644 --- a/cmd/dashboard/controller/oauth2.go +++ b/cmd/dashboard/controller/oauth2.go @@ -64,9 +64,9 @@ func (oa *oauth2controller) login(c *gin.Context) { singleton.Cache.Set(fmt.Sprintf("%s%s", model.CacheKeyOauth2State, stateKey), state, cache.DefaultExpiration) url := oa.getCommonOauth2Config(c).AuthCodeURL(state, oauth2.AccessTypeOnline) c.SetCookie(singleton.Conf.Site.CookieName+"-sk", stateKey, 60*5, "", "", false, false) - c.HTML(http.StatusOK, "dashboard/redirect", gin.H{ + c.HTML(http.StatusOK, "dashboard/redirect", mygin.CommonEnvironment(c, gin.H{ "URL": url, - }) + })) } func (oa *oauth2controller) callback(c *gin.Context) { @@ -125,7 +125,7 @@ func (oa *oauth2controller) callback(c *gin.Context) { user.IssueNewToken() singleton.DB.Save(&user) c.SetCookie(singleton.Conf.Site.CookieName, user.Token, 60*60*24, "", "", false, false) - c.HTML(http.StatusOK, "dashboard/redirect", gin.H{ + c.HTML(http.StatusOK, "dashboard/redirect", mygin.CommonEnvironment(c, gin.H{ "URL": "/", - }) + })) } diff --git a/resource/template/dashboard/redirect.html b/resource/template/dashboard/redirect.html index 8edb5fe..6dda610 100644 --- a/resource/template/dashboard/redirect.html +++ b/resource/template/dashboard/redirect.html @@ -10,6 +10,7 @@ +

Please click here if you are not redirected.