mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-20 15:24:25 +01:00
Prevent accidental double unlocks (#1315)
* Prevent a hint from being unlocked twice * Closes #1301
This commit is contained in:
@@ -59,6 +59,16 @@ class UnlockList(Resource):
|
||||
if response.errors:
|
||||
return {"success": False, "errors": response.errors}, 400
|
||||
|
||||
existing = Unlocks.query.filter_by(**req).first()
|
||||
if existing:
|
||||
return (
|
||||
{
|
||||
"success": False,
|
||||
"errors": {"target": "You've already unlocked this this target"},
|
||||
},
|
||||
400,
|
||||
)
|
||||
|
||||
db.session.add(response.data)
|
||||
|
||||
award_schema = AwardSchema()
|
||||
|
||||
Reference in New Issue
Block a user