gitea/modules/setting
wxiaoguang 0148d03f21
Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187)
Fix #880

Design:

1. A global setting `security.TWO_FACTOR_AUTH`.
* To support org-level config, we need to introduce a better "owner
setting" system first (in the future)
2. A user without 2FA can login and may explore, but can NOT read or
write to any repositories via API/web.
3. Keep things as simple as possible.
* This option only aggressively suggest users to enable their 2FA at the
moment, it does NOT guarantee that users must have 2FA before all other
operations, it should be good enough for real world use cases.
* Some details and tests could be improved in the future since this
change only adds a check and seems won't affect too much.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-04-28 15:31:59 -07:00
..
config Customizable "Open with" applications for repository clone (#29320) 2024-02-24 13:12:17 +00:00
actions_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
actions.go Enable compression for Actions logs by default (#32013) 2024-09-09 21:34:42 +00:00
admin.go Enhance USER_DISABLED_FEATURES to allow disabling change username or full name (#31959) 2024-10-05 20:41:38 +00:00
api.go Add API endpoint to request contents of multiple files simultaniously (#34139) 2025-04-22 01:20:11 +08:00
asset_dynamic.go Use a general approach to access custom/static/builtin assets (#24022) 2023-04-12 18:16:45 +08:00
asset_static.go Use a general approach to access custom/static/builtin assets (#24022) 2023-04-12 18:16:45 +08:00
attachment_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
attachment.go Add avif image file support (#32508) 2024-11-15 00:55:50 +00:00
cache.go Always enable caches (#28527) 2023-12-19 09:29:05 +00:00
camo.go Use camo.Always instead of camo.Allways (#32097) 2024-09-21 12:50:54 +03:00
config_env_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
config_env.go Make Gitea always use its internal config, ignore /etc/gitconfig (#33076) 2025-01-02 20:26:48 +00:00
config_provider_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
config_provider.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
config.go Customizable "Open with" applications for repository clone (#29320) 2024-02-24 13:12:17 +00:00
cors.go Fix settings not being loaded at CLI (#26402) 2024-12-30 05:54:20 +00:00
cron_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
cron.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
database_sqlite.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
database_test.go Fix incorrect PostgreSQL connection string for Unix sockets (#28865) 2024-01-20 16:04:47 +00:00
database.go Add slow SQL query warning (#27545) 2024-02-23 00:57:24 +00:00
federation.go Remove SHA1 for support for ssh rsa signing (#31857) 2024-09-07 18:05:18 -04:00
git_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
git.go Use [git.config] for reflog cleaning up (#24958) 2023-05-28 01:07:14 +00:00
gloabl_lock.go Use global lock instead of NewExclusivePool to allow distributed lock between multiple Gitea instances (#31813) 2024-09-06 10:12:41 +00:00
glob.go Improve grep search (#30843) 2024-05-03 09:13:48 +00:00
global_lock_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
global.go Fix duplicate sub-path for avatars (#31365) 2024-06-15 11:43:57 +08:00
highlight.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
i18n.go Update i18n.go - Language Picker (#32933) 2024-12-21 04:56:08 +00:00
incoming_email.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
indexer_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
indexer.go Fix bleve fuzziness search (#33078) 2025-01-03 00:32:02 +08:00
lfs_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
lfs.go Use 8 as default value for git lfs concurrency (#32421) 2024-11-05 13:10:57 +00:00
log_test.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
log.go Use filepath.Join instead of path.Join for file system file operations (#33978) 2025-03-24 14:50:28 -07:00
mailer_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
mailer.go Email option to embed images as base64 instead of link (#32061) 2025-03-05 16:29:29 +00:00
markup_test.go Fix markdown render behaviors (#34122) 2025-04-05 11:56:48 +08:00
markup.go Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (#34152) 2025-04-09 07:52:01 +00:00
metrics.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
migrations.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
mime_type_map.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
mirror.go Avoid polluting the config (#25345) 2023-06-18 16:10:44 +00:00
oauth2_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
oauth2.go Always load or generate oauth2 jwt secret (#30942) 2024-05-14 14:21:38 +00:00
other.go Add [other].SHOW_FOOTER_POWERED_BY setting to hide Powered by (#30253) 2024-04-03 16:01:50 +00:00
packages_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
packages.go Fix package upload temp path (#34196) 2025-04-14 18:55:02 +08:00
path_test.go Refactor path & config system (#25330) 2023-06-21 13:50:26 +08:00
path.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +00:00
picture.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
project.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
proxy.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
queue.go Increase queue length (#27555) 2023-10-10 18:47:49 +08:00
repository_archive_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
repository_archive.go Fix all possible setting error related storages and added some tests (#23911) 2023-06-14 11:42:38 +08:00
repository.go Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
security.go Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187) 2025-04-28 15:31:59 -07:00
server.go Make public URL generation configurable (#34250) 2025-04-22 06:49:37 +08:00
service_test.go Add a config option to block "expensive" pages for anonymous users (#34024) 2025-03-30 05:26:19 +00:00
service.go Add middleware for request prioritization (#33951) 2025-04-14 16:25:48 +02:00
session.go Fix settings not being loaded at CLI (#26402) 2024-12-30 05:54:20 +00:00
setting_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
setting.go Move ParseBool to optional (#33979) 2025-03-24 03:53:30 +00:00
ssh.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +00:00
storage_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
storage.go enable staticcheck QFxxxx rules (#34064) 2025-03-29 17:32:28 -04:00
task.go handle deprecated settings (#22992) 2023-02-20 16:18:26 -06:00
time.go Fix settings not being loaded at CLI (#26402) 2024-12-30 05:54:20 +00:00
ui.go Add material icons for file list (#33837) 2025-03-10 15:57:17 +08:00
webhook.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00