Reduce conditionals in signin/signup inner forms

by always using SignInLink and SignUpLink in the form action
tokarchuk/v1.17
Sandro Santilli 8 years ago
parent 9182a35f18
commit 15f5d8e794
  1. 13
      routers/user/auth.go
  2. 2
      templates/user/auth/signin_inner.tmpl
  3. 2
      templates/user/auth/signup_inner.tmpl

@ -120,6 +120,7 @@ func SignIn(ctx *context.Context) {
}
ctx.Data["OAuth2Providers"] = oauth2Providers
ctx.Data["Title"] = ctx.Tr("sign_in")
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsLogin"] = true
@ -128,16 +129,16 @@ func SignIn(ctx *context.Context) {
// SignInPost response for sign in request
func SignInPost(ctx *context.Context, form auth.SignInForm) {
ctx.Data["Title"] = ctx.Tr("sign_in")
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsLogin"] = true
oauth2Providers, err := models.GetActiveOAuth2Providers()
if err != nil {
ctx.Handle(500, "UserSignIn", err)
return
}
ctx.Data["OAuth2Providers"] = oauth2Providers
ctx.Data["Title"] = ctx.Tr("sign_in")
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsLogin"] = true
if ctx.HasError() {
ctx.HTML(200, tplSignIn)
@ -700,6 +701,8 @@ func SignOut(ctx *context.Context) {
func SignUp(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("sign_up")
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
@ -711,6 +714,8 @@ func SignUp(ctx *context.Context) {
func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
ctx.Data["Title"] = ctx.Tr("sign_up")
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
if setting.Service.DisableRegistration {

@ -5,7 +5,7 @@
{{.i18n.Tr "auth.login_userpass"}}
</h4>
<div class="ui attached segment">
<form class="ui form" action="{{if not .LinkAccountMode}}{{.Link}}{{else}}{{.SignInLink}}{{end}}" method="post">
<form class="ui form" action="{{.SignInLink}}" method="post">
{{.CsrfTokenHtml}}
<div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
<label for="user_name">{{.i18n.Tr "home.uname_holder"}}</label>

@ -1,7 +1,7 @@
<div class="user signup{{if .LinkAccountMode}} icon{{end}}">
<div class="ui middle very relaxed page grid">
<div class="column">
<form class="ui form" action="{{if not .LinkAccountMode}}{{.Link}}{{else}}{{.SignUpLink}}{{end}}" method="post">
<form class="ui form" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}}
<h3 class="ui top attached header">
{{.i18n.Tr "sign_up"}}

Loading…
Cancel
Save