Use the register destination when coming from the login page
This commit is contained in:
parent
782db18cc3
commit
d7b43fdea0
|
@ -105,9 +105,13 @@ func BuildLogoutAction(redir string) string {
|
||||||
|
|
||||||
var RegexRegister = regexp.MustCompile("^/register$")
|
var RegexRegister = regexp.MustCompile("^/register$")
|
||||||
|
|
||||||
func BuildRegister() string {
|
func BuildRegister(destination string) string {
|
||||||
defer CatchPanic()
|
defer CatchPanic()
|
||||||
return Url("/register", nil)
|
var query []Q
|
||||||
|
if destination != "" {
|
||||||
|
query = append(query, Q{"destination", destination})
|
||||||
|
}
|
||||||
|
return Url("/register", query)
|
||||||
}
|
}
|
||||||
|
|
||||||
var RegexRegistrationSuccess = regexp.MustCompile("^/registered_successfully$")
|
var RegexRegistrationSuccess = regexp.MustCompile("^/registered_successfully$")
|
||||||
|
@ -341,7 +345,7 @@ func BuildProjectNew() string {
|
||||||
func BuildProjectNewJam() string {
|
func BuildProjectNewJam() string {
|
||||||
defer CatchPanic()
|
defer CatchPanic()
|
||||||
|
|
||||||
return Url("/p/new", []Q{Q{Name: "jam", Value: "1"}})
|
return Url("/p/new", []Q{{Name: "jam", Value: "1"}})
|
||||||
}
|
}
|
||||||
|
|
||||||
var RegexPersonalProject = regexp.MustCompile("^/p/(?P<projectid>[0-9]+)(/(?P<projectslug>[a-zA-Z0-9-]+))?")
|
var RegexPersonalProject = regexp.MustCompile("^/p/(?P<projectid>[0-9]+)(/(?P<projectslug>[a-zA-Z0-9-]+))?")
|
||||||
|
|
|
@ -33,11 +33,13 @@ func LoginPage(c *RequestContext) ResponseData {
|
||||||
return c.RejectRequest("You are already logged in.")
|
return c.RejectRequest("You are already logged in.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirect := c.Req.URL.Query().Get("redirect")
|
||||||
|
|
||||||
var res ResponseData
|
var res ResponseData
|
||||||
res.MustWriteTemplate("auth_login.html", LoginPageData{
|
res.MustWriteTemplate("auth_login.html", LoginPageData{
|
||||||
BaseData: getBaseData(c, "Log in", nil),
|
BaseData: getBaseData(c, "Log in", nil),
|
||||||
RedirectUrl: c.Req.URL.Query().Get("redirect"),
|
RedirectUrl: redirect,
|
||||||
RegisterUrl: hmnurl.BuildRegister(),
|
RegisterUrl: hmnurl.BuildRegister(redirect),
|
||||||
ForgotPasswordUrl: hmnurl.BuildRequestPasswordReset(),
|
ForgotPasswordUrl: hmnurl.BuildRequestPasswordReset(),
|
||||||
}, c.Perf)
|
}, c.Perf)
|
||||||
return res
|
return res
|
||||||
|
@ -387,6 +389,7 @@ func EmailConfirmationSubmit(c *RequestContext) ResponseData {
|
||||||
BaseData: baseData,
|
BaseData: baseData,
|
||||||
Token: token,
|
Token: token,
|
||||||
Username: username,
|
Username: username,
|
||||||
|
DestinationURL: destination,
|
||||||
}, c.Perf)
|
}, c.Perf)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadc
|
||||||
LoginActionUrl: hmnurl.BuildLoginAction(c.FullUrl()),
|
LoginActionUrl: hmnurl.BuildLoginAction(c.FullUrl()),
|
||||||
LogoutActionUrl: hmnurl.BuildLogoutAction(c.FullUrl()),
|
LogoutActionUrl: hmnurl.BuildLogoutAction(c.FullUrl()),
|
||||||
ForgotPasswordUrl: hmnurl.BuildRequestPasswordReset(),
|
ForgotPasswordUrl: hmnurl.BuildRequestPasswordReset(),
|
||||||
RegisterUrl: hmnurl.BuildRegister(),
|
RegisterUrl: hmnurl.BuildRegister(""),
|
||||||
|
|
||||||
HMNHomepageUrl: hmnurl.BuildHomepage(),
|
HMNHomepageUrl: hmnurl.BuildHomepage(),
|
||||||
ProjectIndexUrl: hmnurl.BuildProjectIndex(1),
|
ProjectIndexUrl: hmnurl.BuildProjectIndex(1),
|
||||||
|
|
Loading…
Reference in New Issue