Include query in sign in redirect (#11579)
* Include query in sign in redirect Include query string in ctx.Data["SignInLink"] so people are redirected to the right page after singing in. Fixes case of: Visit: https://try.gitea.io/mrsdizzie/testcase/issues?q=&type=all&sort=&state=open&labels=7071&milestone=0&assignee=0 Sign in, then redirected to: https://try.gitea.io/mrsdizzie/testcase/issues Create a new "SignInLink" instead of updating the existing "Link" because too many places in the code assume "Link" won't have a query * Apply suggestions from code review Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
3affe9516a
commit
2842f6cf42
2 changed files with 2 additions and 1 deletions
|
@ -242,6 +242,7 @@ func Contexter() macaron.Handler {
|
||||||
}
|
}
|
||||||
ctx.Data["Language"] = ctx.Locale.Language()
|
ctx.Data["Language"] = ctx.Locale.Language()
|
||||||
c.Data["Link"] = ctx.Link
|
c.Data["Link"] = ctx.Link
|
||||||
|
ctx.Data["CurrentURL"] = setting.AppSubURL + c.Req.URL.RequestURI()
|
||||||
ctx.Data["PageStartTime"] = time.Now()
|
ctx.Data["PageStartTime"] = time.Now()
|
||||||
// Quick responses appropriate go-get meta with status 200
|
// Quick responses appropriate go-get meta with status 200
|
||||||
// regardless of if user have access to the repository,
|
// regardless of if user have access to the repository,
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
{{svg "octicon-person" 16}} {{.i18n.Tr "register"}}
|
{{svg "octicon-person" 16}} {{.i18n.Tr "register"}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
<a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{.Link}}">
|
<a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{.CurrentURL}}">
|
||||||
{{svg "octicon-sign-in" 16}} {{.i18n.Tr "sign_in"}}
|
{{svg "octicon-sign-in" 16}} {{.i18n.Tr "sign_in"}}
|
||||||
</a>
|
</a>
|
||||||
</div><!-- end anonymous right menu -->
|
</div><!-- end anonymous right menu -->
|
||||||
|
|
Reference in a new issue