Skip to content

Commit 218519f

Browse files
colorful3pedro
authored andcommitted
Fix/close notify (#42)
* feat: 在注册校验层,增加group_id字段的存在性判断 * fix: 暂时移除notify接口
1 parent d7f9478 commit 218519f

3 files changed

Lines changed: 6 additions & 85 deletions

File tree

app/api/cms/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ def create_cms():
1313
from .admin import admin_api
1414
from .user import user_api
1515
from .log import log_api
16-
from .notify import notify_api
1716
from .test import test_api
1817
admin_api.register(cms)
1918
user_api.register(cms)
2019
log_api.register(cms)
21-
notify_api.register(cms)
2220
test_api.register(cms)
2321
return cms

app/api/cms/notify.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

app/validators/forms.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:copyright: © 2019 by the Lin team.
33
:license: MIT, see LICENSE for more details.
44
"""
5-
5+
from lin import manager
66
from wtforms import DateTimeField, PasswordField, FieldList, IntegerField, StringField
77
from wtforms.validators import DataRequired, Regexp, EqualTo, length, Optional, NumberRange
88
import time
@@ -27,6 +27,11 @@ class RegisterForm(Form):
2727
Optional()
2828
])
2929

30+
def validate_group_id(self, value):
31+
exists = manager.group_model.get(id=value.data)
32+
if not exists:
33+
raise ValueError('分组不存在')
34+
3035

3136
# 登陆校验
3237
class LoginForm(Form):

0 commit comments

Comments
 (0)