Skip to content

Commit 5d0f6a0

Browse files
authored
Merge branch 'main' into refactor-commit-list-page-group-by-date
2 parents c81ab46 + 44d7d29 commit 5d0f6a0

File tree

169 files changed

+1735
-1229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+1735
-1229
lines changed

.github/workflows/pull-e2e-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
uses: ./.github/workflows/files-changed.yml
1313

1414
test-e2e:
15-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
15+
# the "test-e2e" won't pass, and it seems that there is no useful test, so skip
16+
# if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
17+
if: false
1618
needs: files-changed
1719
runs-on: ubuntu-latest
1820
steps:

assets/go-licenses.json

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/admin_auth_ldap.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010

1111
"code.gitea.io/gitea/models/auth"
12+
"code.gitea.io/gitea/modules/util"
1213
"code.gitea.io/gitea/services/auth/source/ldap"
1314

1415
"github.com/urfave/cli/v2"
@@ -210,8 +211,8 @@ func newAuthService() *authService {
210211
}
211212
}
212213

213-
// parseAuthSource assigns values on authSource according to command line flags.
214-
func parseAuthSource(c *cli.Context, authSource *auth.Source) {
214+
// parseAuthSourceLdap assigns values on authSource according to command line flags.
215+
func parseAuthSourceLdap(c *cli.Context, authSource *auth.Source) {
215216
if c.IsSet("name") {
216217
authSource.Name = c.String("name")
217218
}
@@ -227,6 +228,7 @@ func parseAuthSource(c *cli.Context, authSource *auth.Source) {
227228
if c.IsSet("disable-synchronize-users") {
228229
authSource.IsSyncEnabled = !c.Bool("disable-synchronize-users")
229230
}
231+
authSource.TwoFactorPolicy = util.Iif(c.Bool("skip-local-2fa"), "skip", "")
230232
}
231233

232234
// parseLdapConfig assigns values on config according to command line flags.
@@ -298,9 +300,6 @@ func parseLdapConfig(c *cli.Context, config *ldap.Source) error {
298300
if c.IsSet("allow-deactivate-all") {
299301
config.AllowDeactivateAll = c.Bool("allow-deactivate-all")
300302
}
301-
if c.IsSet("skip-local-2fa") {
302-
config.SkipLocalTwoFA = c.Bool("skip-local-2fa")
303-
}
304303
if c.IsSet("enable-groups") {
305304
config.GroupsEnabled = c.Bool("enable-groups")
306305
}
@@ -376,7 +375,7 @@ func (a *authService) addLdapBindDn(c *cli.Context) error {
376375
},
377376
}
378377

379-
parseAuthSource(c, authSource)
378+
parseAuthSourceLdap(c, authSource)
380379
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
381380
return err
382381
}
@@ -398,7 +397,7 @@ func (a *authService) updateLdapBindDn(c *cli.Context) error {
398397
return err
399398
}
400399

401-
parseAuthSource(c, authSource)
400+
parseAuthSourceLdap(c, authSource)
402401
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
403402
return err
404403
}
@@ -427,7 +426,7 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
427426
},
428427
}
429428

430-
parseAuthSource(c, authSource)
429+
parseAuthSourceLdap(c, authSource)
431430
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
432431
return err
433432
}
@@ -449,7 +448,7 @@ func (a *authService) updateLdapSimpleAuth(c *cli.Context) error {
449448
return err
450449
}
451450

452-
parseAuthSource(c, authSource)
451+
parseAuthSourceLdap(c, authSource)
453452
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
454453
return err
455454
}

cmd/admin_auth_oauth.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010

1111
auth_model "code.gitea.io/gitea/models/auth"
12+
"code.gitea.io/gitea/modules/util"
1213
"code.gitea.io/gitea/services/auth/source/oauth2"
1314

1415
"github.com/urfave/cli/v2"
@@ -156,7 +157,6 @@ func parseOAuth2Config(c *cli.Context) *oauth2.Source {
156157
OpenIDConnectAutoDiscoveryURL: c.String("auto-discover-url"),
157158
CustomURLMapping: customURLMapping,
158159
IconURL: c.String("icon-url"),
159-
SkipLocalTwoFA: c.Bool("skip-local-2fa"),
160160
Scopes: c.StringSlice("scopes"),
161161
RequiredClaimName: c.String("required-claim-name"),
162162
RequiredClaimValue: c.String("required-claim-value"),
@@ -185,10 +185,11 @@ func runAddOauth(c *cli.Context) error {
185185
}
186186

187187
return auth_model.CreateSource(ctx, &auth_model.Source{
188-
Type: auth_model.OAuth2,
189-
Name: c.String("name"),
190-
IsActive: true,
191-
Cfg: config,
188+
Type: auth_model.OAuth2,
189+
Name: c.String("name"),
190+
IsActive: true,
191+
Cfg: config,
192+
TwoFactorPolicy: util.Iif(c.Bool("skip-local-2fa"), "skip", ""),
192193
})
193194
}
194195

@@ -294,6 +295,6 @@ func runUpdateOauth(c *cli.Context) error {
294295

295296
oAuth2Config.CustomURLMapping = customURLMapping
296297
source.Cfg = oAuth2Config
297-
298+
source.TwoFactorPolicy = util.Iif(c.Bool("skip-local-2fa"), "skip", "")
298299
return auth_model.UpdateSource(ctx, source)
299300
}

cmd/admin_auth_stmp.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ func parseSMTPConfig(c *cli.Context, conf *smtp.Source) error {
117117
if c.IsSet("disable-helo") {
118118
conf.DisableHelo = c.Bool("disable-helo")
119119
}
120-
if c.IsSet("skip-local-2fa") {
121-
conf.SkipLocalTwoFA = c.Bool("skip-local-2fa")
122-
}
123120
return nil
124121
}
125122

@@ -156,10 +153,11 @@ func runAddSMTP(c *cli.Context) error {
156153
}
157154

158155
return auth_model.CreateSource(ctx, &auth_model.Source{
159-
Type: auth_model.SMTP,
160-
Name: c.String("name"),
161-
IsActive: active,
162-
Cfg: &smtpConfig,
156+
Type: auth_model.SMTP,
157+
Name: c.String("name"),
158+
IsActive: active,
159+
Cfg: &smtpConfig,
160+
TwoFactorPolicy: util.Iif(c.Bool("skip-local-2fa"), "skip", ""),
163161
})
164162
}
165163

@@ -195,6 +193,6 @@ func runUpdateSMTP(c *cli.Context) error {
195193
}
196194

197195
source.Cfg = smtpConfig
198-
196+
source.TwoFactorPolicy = util.Iif(c.Bool("skip-local-2fa"), "skip", "")
199197
return auth_model.UpdateSource(ctx, source)
200198
}

custom/conf/app.example.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,10 @@ INTERNAL_TOKEN =
524524
;;
525525
;; On user registration, record the IP address and user agent of the user to help identify potential abuse.
526526
;; RECORD_USER_SIGNUP_METADATA = false
527+
;;
528+
;; Set the two-factor auth behavior.
529+
;; Set to "enforced", to force users to enroll into Two-Factor Authentication, users without 2FA have no access to repositories via API or web.
530+
;TWO_FACTOR_AUTH =
527531

528532
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
529533
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1155,6 +1159,10 @@ LEVEL = Info
11551159
;;
11561160
;; Retarget child pull requests to the parent pull request branch target on merge of parent pull request. It only works on merged PRs where the head and base branch target the same repo.
11571161
;RETARGET_CHILDREN_ON_MERGE = true
1162+
;;
1163+
;; Delay mergeable check until page view or API access, for pull requests that have not been updated in the specified days when their base branches get updated.
1164+
;; Use "-1" to always check all pull requests (old behavior). Use "0" to always delay the checks.
1165+
;DELAY_CHECK_FOR_INACTIVE_DAYS = 7
11581166

11591167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11601168
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 commit comments

Comments
 (0)