diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-27 18:14:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-27 18:14:25 +0800 |
commit | 94da47271701401b6959bfd308d6c74fd30b22e2 (patch) | |
tree | 92a6c3298ab198efa04fbe4409d282da44736640 /routers/user/auth.go | |
parent | 0a76d260fa16764ab66bf1623b4cd9e9adfdac27 (diff) | |
download | gitea-94da47271701401b6959bfd308d6c74fd30b22e2.tar.gz gitea-94da47271701401b6959bfd308d6c74fd30b22e2.zip |
Golint fixed for modules/setting (#262)
* golint fixed for modules/setting
* typo fixed and renamed UNIXSOCKET to UnixSocket
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r-- | routers/user/auth.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go index ebee24365c..eecb5e051f 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -44,8 +44,8 @@ func AutoSignIn(ctx *context.Context) (bool, error) { defer func() { if !isSucceed { log.Trace("auto-login cookie cleared: %s", uname) - ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) - ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL) + ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL) } }() @@ -65,7 +65,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) { isSucceed = true ctx.Session.Set("uid", u.ID) ctx.Session.Set("uname", u.Name) - ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL) return true, nil } @@ -82,17 +82,17 @@ func SignIn(ctx *context.Context) { redirectTo := ctx.Query("redirect_to") if len(redirectTo) > 0 { - ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubUrl) + ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL) } else { redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to")) } if isSucceed { if len(redirectTo) > 0 { - ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl) + ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL) ctx.Redirect(redirectTo) } else { - ctx.Redirect(setting.AppSubUrl + "/") + ctx.Redirect(setting.AppSubURL + "/") } return } @@ -121,16 +121,16 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { if form.Remember { days := 86400 * setting.LogInRememberDays - ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl) + ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubURL) ctx.SetSuperSecureCookie(base.EncodeMD5(u.Rands+u.Passwd), - setting.CookieRememberName, u.Name, days, setting.AppSubUrl) + setting.CookieRememberName, u.Name, days, setting.AppSubURL) } ctx.Session.Set("uid", u.ID) ctx.Session.Set("uname", u.Name) // Clear whatever CSRF has right now, force to generate a new one - ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL) // Register last login u.SetLastLogin() @@ -140,12 +140,12 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { } if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 { - ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl) + ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL) ctx.Redirect(redirectTo) return } - ctx.Redirect(setting.AppSubUrl + "/") + ctx.Redirect(setting.AppSubURL + "/") } // SignOut sign out from login status @@ -155,10 +155,10 @@ func SignOut(ctx *context.Context) { ctx.Session.Delete("socialId") ctx.Session.Delete("socialName") ctx.Session.Delete("socialEmail") - ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) - ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) - ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl) - ctx.Redirect(setting.AppSubUrl + "/") + ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubURL) + ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubURL) + ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubURL) + ctx.Redirect(setting.AppSubURL + "/") } // SignUp render the register page @@ -255,7 +255,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo return } - ctx.Redirect(setting.AppSubUrl + "/user/login") + ctx.Redirect(setting.AppSubURL + "/user/login") } // Activate render activate user page @@ -303,7 +303,7 @@ func Activate(ctx *context.Context) { ctx.Session.Set("uid", user.ID) ctx.Session.Set("uname", user.Name) - ctx.Redirect(setting.AppSubUrl + "/") + ctx.Redirect(setting.AppSubURL + "/") return } @@ -326,7 +326,7 @@ func ActivateEmail(ctx *context.Context) { ctx.Flash.Success(ctx.Tr("settings.add_email_success")) } - ctx.Redirect(setting.AppSubUrl + "/user/settings/email") + ctx.Redirect(setting.AppSubURL + "/user/settings/email") return } @@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *context.Context) { } log.Trace("User password reset: %s", u.Name) - ctx.Redirect(setting.AppSubUrl + "/user/login") + ctx.Redirect(setting.AppSubURL + "/user/login") return } |