mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Fixed public project creation flag in API creation #246
This commit is contained in:
parent
5158135ac6
commit
4b18be97e6
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
# coding: utf8
|
||||
from flask import Blueprint, request
|
||||
from flask import Blueprint, request, current_app
|
||||
from flask_restful import Resource, Api, abort
|
||||
from flask_cors import CORS
|
||||
from wtforms.fields.core import BooleanField
|
||||
|
@ -55,7 +55,7 @@ def need_auth(f):
|
|||
class ProjectsHandler(Resource):
|
||||
def post(self):
|
||||
form = ProjectForm(meta={"csrf": False})
|
||||
if form.validate():
|
||||
if form.validate() and current_app.config.get("ALLOW_PUBLIC_PROJECT_CREATION"):
|
||||
project = form.save()
|
||||
db.session.add(project)
|
||||
db.session.commit()
|
||||
|
@ -76,7 +76,7 @@ class ProjectHandler(Resource):
|
|||
|
||||
def put(self, project):
|
||||
form = EditProjectForm(meta={"csrf": False})
|
||||
if form.validate():
|
||||
if form.validate() and current_app.config.get("ALLOW_PUBLIC_PROJECT_CREATION"):
|
||||
form.update(project)
|
||||
db.session.commit()
|
||||
return "UPDATED"
|
||||
|
|
Loading…
Reference in a new issue