Commit Graph

651 Commits (d29f5aaf442493d01af08db22690b3b4a4ccc2f2)

Author SHA1 Message Date
Kevin Chung abd8aae84f Reorder code and fix tests 2020-04-29 18:41:18 -04:00
Kevin Chung 817b67d1b0 Start to refactor tracker to cache user IPs 2020-04-29 18:30:17 -04:00
Kevin Chung 7e3b1962c4 Extract user/team banning code into its own initialization function 2020-04-29 12:46:48 -04:00
Kevin Chung 57d4cb4318 Remove duplicated get_config from models and import before usage 2020-04-29 12:45:10 -04:00
Kevin Chung e15e23f038
Merge pull request #1359 from CTFd/table-granular-admin-reset
* Improve Reset functionality by allowing admins to pick what data they'd like to reset
* Closes #1355
2020-04-28 12:29:11 -04:00
Kevin Chung 289d7441f9 Clean up word 2020-04-28 03:54:46 -04:00
Kevin Chung a62b18fadb Fix up reset ui 2020-04-28 03:53:25 -04:00
Kevin Chung 696872fee5 Delete files when resetting pages and challenges 2020-04-28 02:44:24 -04:00
Kevin Chung 1d33ed4cb2 Fix reset tests and enforce foreign keys on sqlite 2020-04-28 02:08:05 -04:00
Kevin Chung c7bf346ba6
Merge pull request #1349 from CTFd/in-house-export-serialization
* Remove `datafreeze` dependency
* Closes #1348
2020-04-27 21:41:03 -04:00
Kevin Chung cc08f03faa
Merge pull request #1357 from CTFd/admin-users-pagination
* Make Admin Panel user searching use a Pagination object
2020-04-27 21:39:47 -04:00
Kevin Chung 4cfc536b41
Merge pull request #1358 from CTFd/admin-challenges-pagination
* Show total searched results for Admin Panel searching. This doesn't use a Pagination object b/c Admin Panel challenges doesn't paginate.
2020-04-27 20:54:40 -04:00
Kevin Chung c5667dc9d1
Merge pull request #1356 from CTFd/admin-teams-pagination
* Make the admin panel team searching use a pagination object instead of custom searching
2020-04-27 20:22:31 -04:00
Kevin Chung e4a0f99f7e
Merge pull request #1352 from CTFd/1339-submission-searching
* Add Admin Panel UI for submission searching
* Closes #1339
2020-04-27 20:21:46 -04:00
Kevin Chung f4b6afd32c Run make format 2020-04-27 20:15:51 -04:00
Kevin Chung 77af80b538 Run make lint 2020-04-27 20:13:12 -04:00
Kevin Chung 6092ed1f31 Clear caches after populate and enable foreign keys in SQLite 2020-04-27 18:33:53 -04:00
Kevin Chung abcb791b73 Run make lint 2020-04-27 18:13:45 -04:00
Kevin Chung 8a255f8b41 Add a basic layout for improved table granular reset 2020-04-27 18:11:06 -04:00
Kevin Chung 1c9490bcb1 Clean up HTML IDs 2020-04-27 16:59:53 -04:00
Kevin Chung 48bcd76a86 Clean up HTML IDs 2020-04-27 16:59:00 -04:00
Kevin Chung d9e069933f Clean up HTML ids 2020-04-27 16:58:02 -04:00
Kevin Chung 2fa2c6074f Remove unnecessary js 2020-04-27 16:53:51 -04:00
Kevin Chung 708c6383d8 Run yarn build 2020-04-27 16:44:22 -04:00
Kevin Chung 839a767c8c Show search results on challenge search 2020-04-27 16:40:58 -04:00
Kevin Chung 052ce49e14 Fix lints 2020-04-27 16:28:45 -04:00
Kevin Chung e15d58bd11 Fix lints 2020-04-27 16:27:37 -04:00
Kevin Chung 35737e9eea Make admin team searching use a pagination object 2020-04-27 16:27:06 -04:00
Kevin Chung 81341a7730 Make admin user searching use a pagination object 2020-04-27 16:09:57 -04:00
Kevin Chung b5b503e3cf Add abs 2020-04-27 15:54:04 -04:00
Kevin Chung 067b8a4052 Fix tests 2020-04-27 15:49:51 -04:00
Kevin Chung 2d49c8dd9a Switch to using a Flask SQLAlchemy pagination object for submission searching 2020-04-27 15:04:29 -04:00
Kevin Chung 8c10c731be Add UI for submission searching 2020-04-27 13:46:36 -04:00
Kevin Chung 228701cae7 Run prettier 2020-04-27 13:10:35 -04:00
Kevin Chung 41a0ebc68d Make minified JSON 2020-04-27 02:00:11 -04:00
Kevin Chung 89ade49695 Fix serializer 2020-04-27 01:49:56 -04:00
Kevin Chung 593fed300b Remove datafreeze dependency 2020-04-27 01:02:52 -04:00
Kevin Chung 6099abf1a1 Add proper syntax highlighting for codemirror and make theme footer & header use codemirror 2020-04-26 02:32:28 -04:00
Kevin Chung 04eedb4a4e Run yarn build 2020-04-25 16:45:24 -04:00
Kevin Chung 1ad520a8e7 Run prettier 2020-04-25 13:05:00 -04:00
Kevin Chung ff2e4c9dd0 Change the page selector to be less verbose 2020-04-25 13:05:00 -04:00
Kevin Chung dbb07b5beb Clean code a bit 2020-04-25 02:55:22 -04:00
Kevin Chung 7fbcf9793b Remove unused import 2020-04-24 15:45:42 -04:00
Kevin Chung 449e0d8939 Add basic challenge searching functionality 2020-04-24 15:35:00 -04:00
Kevin Chung 2f36c5d680
Adding sortable columns to admin panel (#1337)
* Columns can opt-in to being sortable with the `sort-col` class on `th` elements
* Add checkboxes to main admin panels and convert per-line actions into bulk actions
2020-04-23 13:35:23 -04:00
Kevin Chung 8ab99dc577 Remove commented HTML 2020-04-23 13:34:38 -04:00
Kevin Chung 1f87efb6c1
Better constant value management (#1335)
* Starts work on #929 
* Adds Enum classes that can be accessed from JS, Jinja, and Python code. This allows for the sharing of constant values between the three major codebases in CTFd.
2020-04-23 10:48:09 -04:00
Kevin Chung 89a266cf2c Run yarn build 2020-04-23 08:52:29 -04:00
Kevin Chung 0bb1a5d0bd Run make format 2020-04-23 02:28:05 -04:00
Kevin Chung d8e766734a Add bulk buttons 2020-04-22 20:32:10 -04:00
Kevin Chung d5fd2f8f2a Setup bulk deletion buttons 2020-04-22 18:49:57 -04:00
Kevin Chung 5f4af2a3f2 Fix tables 2020-04-22 17:24:33 -04:00
Kevin Chung be643dee90 Run prettier 2020-04-22 15:26:08 -04:00
Kevin Chung 7b9cd1df25 Consolidate buttons 2020-04-22 15:20:27 -04:00
Kevin Chung 3d058bce05 Switch to using outline button 2020-04-22 14:57:37 -04:00
Kevin Chung 3a15c155c7 Make it easier to click checkbox 2020-04-21 22:38:46 -04:00
Kevin Chung fa434c4bdd
Fix file downloads in Windows (#1336)
* Fixes an issue where files could not be downloaded when running on Windows
* Closes #1334
2020-04-21 15:40:06 -04:00
Kevin Chung 052911f930 Add a construct for sortable columns 2020-04-21 15:39:14 -04:00
Kevin Chung 24c3520685
Change challenge visibility badge on challenge update (#1331)
* Refresh challenge visibility badge after challenge update. A stopgap solution until a better state based UI is implemented. 
* Closes #1267
2020-04-18 03:43:30 -04:00
Kevin Chung 25fe789da8
Add fix for SMTP server overriding and #1306 (#1330)
* Fix a potential issue where config.py SMTP settings might not have been overrideable from the Admin Panel
* Closes #1306 by using `email.message.EmailMessage` in Python 3. Python 2 will use the old `sendmail` behavior.
2020-04-18 03:33:34 -04:00
Kevin Chung cd6439f2eb
Add a bell curve graph and total points calculation (#1325)
* Add a bell curve graph and total points calculation to admin panel statistics
* Closes #608
2020-04-17 03:10:55 -04:00
Kevin Chung ccefe47468 Handle logging situation where a submission isn't provided to challenge attempt 2020-04-17 01:48:09 -04:00
Kevin Chung e113b2d627 Fix Admin Panel link from deprecating session type 2020-04-15 03:38:25 -04:00
Kevin Chung 0cfbf90201 Closes #1256 2020-04-15 03:24:16 -04:00
Kevin Chung 578b5261b2
Deprecates storing user type in session (#1323)
* Deprecates storing session["type"] as a means of referring to the user's current level. Instead you should refer to the database.
* Adds `CTFd.utils.user.get_current_user_type()` to get the current user's type or return None if the user is unauthed. 
* Closes #1279
2020-04-15 03:04:18 -04:00
‏‏Dave 6f87129846
Replace flask_restful with flask_restx (#1282)
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2020-04-14 15:26:50 -04:00
Kevin Chung 05e5730c54
Fix media library refresh on upload (#1319) 2020-04-14 12:42:15 -04:00
Kevin Chung 4b6c9ec8bd
Mark 2.3.3 (#1316)
2.3.3 / 2020-04-12
==================

**General**
* Re-enable the Jinja LRU Cache for **significant speedups** when returning HTML content

**API**
* `POST /api/v1/unlocks` will no longer allow duplicate unlocks to happen

**Admin Panel**
* Makes `Account Visibility` subtext clearer by explaining the `Private` setting in Config Panel

**Themes**
* Fixes an issue with using a theme with a purely numeric name
* Fixes issue where the scoreboard graph always said Teams regardless of mode

**Miscellaneous**
* Bump max log file size to 10 MB and fix log rotation
* Docker image dependencies (apk & pip) are no longer cached reducing the image size slightly
2020-04-12 15:33:00 -04:00
Kevin Chung 04e6b2011f
Prevent accidental double unlocks (#1315)
* Prevent a hint from being unlocked twice
* Closes  #1301
2020-04-11 22:03:51 -04:00
Kevin Chung aeab4ded6e
Add fix for logrotation (#1311)
* Bump max log file size to 10 MB and fix log rotation on RotatingFileHandler
* Closes #1302
2020-04-11 14:33:40 -04:00
Kevin Chung 320feb9179
Re-enable the Jinja LRU Cache (#1308)
* Re-enable the Jinja LRU Cache by overriding the `Environment._load_template` function and adding a theme namespace
2020-04-10 12:50:55 -04:00
Kevin Chung 1249229faf
Closes #1305 (#1309)
* Makes `Account Visibility` subtext clearer by explaining the `Private` setting
2020-04-10 02:51:49 -04:00
淡水 a854bfc50f
Fix scoreboard top 10 graph's title (#1296)
* Scoreboard graph title properly shows Users or Teams
2020-03-31 16:18:27 -04:00
Alan 76af4419b6
Fix typecasting bug when using utils.get_config to get theme (#1298)
* Fix a type issue with config values. Related to #929
2020-03-30 01:17:29 -04:00
Kevin Chung d80051bcda
Mark 2.3.2 (#1292)
2.3.2 / 2020-03-15
==================

**General**
* Fix awards not being properly assigned to teams in `TEAMS_MODE`

**API**
* Set `/api/v1/statistics/users` route to be admins_only
* When POST'ing to `/api/v1/awards`, CTFd will look up a user's team ID if `team_id` is not specified

**Admin Panel**
* Adds a setting to registration visibility to allow for MLC registration while registration is disabled
* Fix setting theme color during the setup flow and from the Admin Panel

**Themes**
* Fixes users/admins being able to remove profile settings.
    * Previously a bug prevented users from removing some profile settings. Now the `core` theme stores the initial value of inputs as a `data` attribute and checks for changes when updating data. This should be a temporary hack until a proper front-end framework is in place.
* Fix `ezToast()` issue that was keeping toast messages visible indefinitely
* Fix `modal-body` parameters in ezq.js for `ezAlert` and `ezQuery` and fix the progress bar for certain cases in `ezProgressBar`
* Use `authed()` function to check if user is authed in `base.html`. This fixes an issue where a page could look as if the user was logged in.

**Miscellaneous**
* Fix behavior for `REVERSE_PROXY` config setting when set to a boolean instead of a string
* Improve `Dockerfile` to run fewer commands and re-use the build cache
* Add `make coverage` to generate an HTML coverage report
* Update `coverage` and `pytest-cov` development dependencies
2020-03-15 15:33:28 -04:00
Kevin Chung e5f128ec9d
Fix awards in teams mode (#1289)
* Fix awards not being properly assigned to teams in `TEAMS_MODE`
2020-03-14 15:36:44 -04:00
Kevin Chung 64aa55366f
Fix changing profile settings from admin and user settings pages (#1290)
* Fixes users/admins being able to remove profile settings
2020-03-14 12:15:11 -04:00
Kevin Chung 464f7bde58
Use authed function to check if user is authed in base.html (#1283)
* Use `authed` function to check if user is authed in `base.html`
2020-03-08 19:45:24 -04:00
Kevin Chung 348fe5504e
Fix modal-body parameters in ezq.js and fix the progress bar for certain cases in ezProgressBar (#1278)
* Fix `modal-body` parameters in ezq.js for `ezAlert` and `ezQuery` and fix the progress bar for certain cases in `ezProgressBar`
* Mostly copied from #1275
2020-03-04 19:51:01 -05:00
Kevin Chung ae1c2ec50d
Set UserStatistics route to be admins_only (#1276)
* Set UserStatistics route to be admins_only
2020-03-04 01:08:13 -05:00
Kevin Chung 1e86718232
Fix setting theme color from the setup flow (#1273)
* Fix setting theme color from the setup flow
2020-03-03 00:24:57 -05:00
Zander Work 2f106d4fc3
Fix #1249 (#1250)
* Fix behavior for `REVERSE_PROXY` setting when set to a boolean instead of a string
2020-02-29 23:37:57 -05:00
Kevin Chung 65a640184b
Only run the sqlite datetime hack on columns that are expecting a datetime object (#1270)
* Only run the SQLite datetime hack (#246) on columns that are expecting a datetime object
* Closes #1255
2020-02-29 20:17:54 -05:00
Kevin Chung e764bb16b8
Fix custom theme color setting in config panel (#1268)
* Properly update the theme header with custom theme color values 
* Closes #1263
2020-02-29 16:56:05 -05:00
Kevin Chung 2f46f61ed0
Fix ezq toast timeout and fix yarn build command for Python 3 (#1266)
* Fix `ezToast()` timeout
* Force `yarn build` to use Python 3
* Closes #1265
2020-02-29 15:21:22 -05:00
Kevin Chung 7ee47b0abe
Add setting to allow MLC registration only (#1259)
* Adds a setting to registration visibility to allow for MLC registration while registration is disabled
2020-02-23 23:33:34 -05:00
Kevin Chung 0bae69bee4
Prevent double confirmations from happening (#1253)
* Prevents user from confirming their account twice
2020-02-17 21:46:24 -05:00
Kevin Chung 7cd8d90e0c
2.3.1 dev (#1252)
2.3.1 / 2020-02-17
==================

**General**
* User confirmation emails now have the correct URL format
2020-02-17 20:07:17 -05:00
Kevin Chung 22c132358e
2.3.0 (#1248)
2.3.0 / 2020-02-17
==================

**General**
* During setup, admins can register their email address with the CTFd LLC newsletter for news and updates
* Fix editting hints from the admin panel
* Allow admins to insert HTML code directly into the header and footer (end of body tag) of pages. This replaces and supercedes the custom CSS feature.
    * The `views.custom_css` route has been removed.
* Admins can now customize the content of outgoing emails and inject certain variables into email content.
* The `manage.py` script can now manipulate the CTFd Configs table via the `get_config` and `set_config` commands. (e.g. `python manage.py get_config ctf_theme` and `python manage.py set_config ctf_theme core`)

**Themes**
* Themes should now reference the `theme_header` and `theme_footer` configs instead of the `views.custom_css` endpoint to allow for user customizations. See the `base.html` file of the core theme.

**Plugins**
* Make `ezq` functions available to `CTFd.js` under `CTFd.ui.ezq`

**Miscellaneous**
* Python imports sorted with `isort` and import order enforced
* Black formatter running on a majority of Python code
2020-02-17 02:17:25 -05:00
Kevin Chung 1049a14b90
Fix SMTP email From header and remove 'Admin' from the From header (#1229)
* Fix SMTP email From header and remove 'Admin' from the From header
2020-02-11 21:35:58 -05:00
Kevin Chung 309e62520e
Fix dynamic challenge hint loading (#1224)
* Fixes hint loading for dynamic challenges
2020-01-28 22:16:44 -05:00
Kevin Chung d59bfa3578
Mark 2.2.3 (#1222)
2.2.3 / 2020-01-21
==================

### This release includes a critical security fix for CTFd versions >= 2.0.0

All CTFd administrators are recommended to take the following steps:
1. Upgrade their installations to the latest version
2. Rotate the `SECRET_KEY` value
3. Reset the passwords for all administrator users

**Security**
* This release includes a fix for a vulnerability allowing an arbitrary user to take over other accounts given their username and a CTFd instance with emails enabled

**General**
* Users will receive an email notification when their passwords are reset
* Fixed an error when users provided incorrect team join information
2020-01-21 00:06:03 -05:00
Kevin Chung a2551db690
Add a password change notification email (#1221)
* Adds an email notification for password resets
2020-01-20 23:05:44 -05:00
Kevin Chung 60c46af58a
Sign sessions using SECRET_KEY to simplify revocation (#1219)
* Sign sessions using `SECRET_KEY`
* Add `CTFd.utils.security.signing.sign` and `CTFd.utils.security.signing.unsign`
2020-01-20 21:53:08 -05:00
Kevin Chung 83efc4d5eb
Fix error with invalid team information and team size limits (#1220)
* Fix error when joining teams with a size limit
2020-01-20 20:34:11 -05:00
Kevin Chung f660ed1fb7
Strip spaces on registration and have reset password use email address instead of names (#1218)
* Usernames are now properly stripped before being used in registration checks
* Reset password function now uses email addresses instead of user names for tokens
* Prevent MLC users from resetting their password
2020-01-20 14:22:06 -05:00
Kevin Chung fe85fdf1e5
Mark 2.2.2 (#1212)
2.2.2 / 2020-01-09
==================

**General**
* Add jQuery, Moment, nunjucks, and Howl to window globals to make it easier for plugins to access JS modules
* Fix issue with timezone loading in config page which was preventing display of CTF times
2020-01-09 20:32:50 -05:00
Kevin Chung d37805b6fe
Fix timezone loading in time config page (#1211)
* Fix an issue where CTF times could not be displayed in the admin panel because timezones weren't available
2020-01-09 18:41:41 -05:00
Kevin Chung d30bd182d2
Add jQuery, Moment, nunjucks, and Howl to window globals (#1209)
* Add jQuery, Moment, nunjucks, and Howl to window globals
2020-01-08 18:06:15 -05:00
Kevin Chung dc492c97af
Mark 2.2.1 (#1208)
2.2.1 / 2020-01-04
==================

**General**
* Fix issue preventing admins from creating users or teams
* Fix issue importing backups that contained empty directories
2020-01-04 01:20:50 -05:00