Skip to content

Commit bb7f054

Browse files
committed
use signin instead of login
1 parent c534a79 commit bb7f054

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ LEVEL = Info
786786
;;
787787
;; Show the password login form (for password-based login), otherwise, only show OAuth2 login methods.
788788
;; If you set it to false, maybe it also needs to set ENABLE_BASIC_AUTHENTICATION to false to completely disable password-based authentication.
789-
;ENABLE_PASSWORD_LOGIN_FORM = true
789+
;ENABLE_PASSWORD_SIGNIN_FORM = true
790790
;;
791791
;; More detail: https://github.com/gogits/gogs/issues/165
792792
;ENABLE_REVERSE_PROXY_AUTHENTICATION = false

modules/setting/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var Service = struct {
4141
AllowOnlyInternalRegistration bool
4242
AllowOnlyExternalRegistration bool
4343
ShowRegistrationButton bool
44-
EnablePasswordLoginForm bool
44+
EnablePasswordSignInForm bool
4545
ShowMilestonesDashboardPage bool
4646
RequireSignInView bool
4747
EnableNotifyMail bool
@@ -160,7 +160,7 @@ func loadServiceFrom(rootCfg ConfigProvider) {
160160
Service.ShowMilestonesDashboardPage = sec.Key("SHOW_MILESTONES_DASHBOARD_PAGE").MustBool(true)
161161
Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool()
162162
Service.EnableBasicAuth = sec.Key("ENABLE_BASIC_AUTHENTICATION").MustBool(true)
163-
Service.EnablePasswordLoginForm = sec.Key("ENABLE_PASSWORD_LOGIN_FORM").MustBool(true)
163+
Service.EnablePasswordSignInForm = sec.Key("ENABLE_PASSWORD_SIGNIN_FORM").MustBool(true)
164164
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
165165
Service.EnableReverseProxyAuthAPI = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION_API").MustBool()
166166
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()

routers/web/auth/auth.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ func CheckAutoLogin(ctx *context.Context) bool {
160160
return false
161161
}
162162

163-
func prepareSignPageData(ctx *context.Context) {
163+
func prepareSignInPageData(ctx *context.Context) {
164164
ctx.Data["Title"] = ctx.Tr("sign_in")
165165
ctx.Data["OAuth2Providers"], _ = oauth2.GetOAuth2Providers(ctx, optional.Some(true))
166166
ctx.Data["Title"] = ctx.Tr("sign_in")
167167
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
168168
ctx.Data["PageIsSignIn"] = true
169169
ctx.Data["PageIsLogin"] = true
170170
ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx)
171-
ctx.Data["EnablePasswordLoginForm"] = setting.Service.EnablePasswordLoginForm
171+
ctx.Data["EnablePasswordSignInForm"] = setting.Service.EnablePasswordSignInForm
172172

173173
if setting.Service.EnableCaptcha && setting.Service.RequireCaptchaForLogin {
174174
context.SetCaptchaData(ctx)
@@ -184,18 +184,18 @@ func SignIn(ctx *context.Context) {
184184
RedirectAfterLogin(ctx)
185185
return
186186
}
187-
prepareSignPageData(ctx)
187+
prepareSignInPageData(ctx)
188188
ctx.HTML(http.StatusOK, tplSignIn)
189189
}
190190

191191
// SignInPost response for sign in request
192192
func SignInPost(ctx *context.Context) {
193-
if !setting.Service.EnablePasswordLoginForm {
193+
if !setting.Service.EnablePasswordSignInForm {
194194
ctx.Error(http.StatusForbidden)
195195
return
196196
}
197197

198-
prepareSignPageData(ctx)
198+
prepareSignInPageData(ctx)
199199
if ctx.HasError() {
200200
ctx.HTML(http.StatusOK, tplSignIn)
201201
return

templates/user/auth/signin_inner.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{end}}
1111
</h4>
1212
<div class="ui attached segment">
13-
{{if .EnablePasswordLoginForm}}
13+
{{if .EnablePasswordSignInForm}}
1414
<form class="ui form" action="{{.SignInLink}}" method="post">
1515
{{.CsrfTokenHtml}}
1616
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
@@ -47,8 +47,8 @@
4747
</button>
4848
</div>
4949
</form>
50-
{{end}}{{/*if .EnablePasswordLoginForm*/}}
51-
{{if and .OAuth2Providers .EnableOpenIDSignIn .EnablePasswordLoginForm}}
50+
{{end}}{{/*if .EnablePasswordSignInForm*/}}
51+
{{if and .OAuth2Providers .EnableOpenIDSignIn .EnablePasswordSignInForm}}
5252
<div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
5353
{{end}}
5454
{{if and .OAuth2Providers .EnableOpenIDSignIn}}

tests/integration/signin_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ func TestSigninWithRememberMe(t *testing.T) {
9393
session.MakeRequest(t, req, http.StatusOK)
9494
}
9595

96-
func TestEnablePasswordLoginForm(t *testing.T) {
96+
func TestEnablePasswordSignInForm(t *testing.T) {
9797
defer tests.PrepareTestEnv(t)()
9898

99-
t.Run("EnablePasswordLoginForm=false", func(t *testing.T) {
99+
t.Run("EnablePasswordSignInForm=false", func(t *testing.T) {
100100
defer tests.PrintCurrentTest(t)()
101-
defer test.MockVariableValue(&setting.Service.EnablePasswordLoginForm, false)()
101+
defer test.MockVariableValue(&setting.Service.EnablePasswordSignInForm, false)()
102102

103103
req := NewRequest(t, "GET", "/user/login")
104104
resp := MakeRequest(t, req, http.StatusOK)
@@ -108,9 +108,9 @@ func TestEnablePasswordLoginForm(t *testing.T) {
108108
MakeRequest(t, req, http.StatusForbidden)
109109
})
110110

111-
t.Run("EnablePasswordLoginForm=true", func(t *testing.T) {
111+
t.Run("EnablePasswordSignInForm=true", func(t *testing.T) {
112112
defer tests.PrintCurrentTest(t)()
113-
defer test.MockVariableValue(&setting.Service.EnablePasswordLoginForm, true)()
113+
defer test.MockVariableValue(&setting.Service.EnablePasswordSignInForm, true)()
114114

115115
req := NewRequest(t, "GET", "/user/login")
116116
resp := MakeRequest(t, req, http.StatusOK)

0 commit comments

Comments
 (0)