fixes #16: avoid adding empty group/attendees

This commit is contained in:
Davide Alberani 2017-01-26 22:38:57 +01:00
parent 8b4c739dfe
commit 4f77b3953d
2 changed files with 7 additions and 1 deletions

View file

@ -207,6 +207,11 @@ class AttendeesHandler(BaseHandler):
@gen.coroutine
def post(self, **kwargs):
data = self.clean_body
for key in 'name', 'group', 'day':
value = (data.get(key) or '').strip()
if not value:
return self.build_error(status=404, message="%s can't be empty" % key)
data[key] = value
user_id = self.current_user_info.get('_id')
now = datetime.datetime.now()
data['created_by'] = user_id

View file

@ -153,7 +153,8 @@ export default {
this.attendeesUrl.save(attendee).then((response) => {
return response.json();
}, (response) => {
this.$refs.dialogObj.show({text: 'unable to add the attendee'});
var msg = (response && response.body && response.body.message) || '';
this.$refs.dialogObj.show({text: 'unable to add the attendee: ' + msg});
}).then((json) => {
this.reset();
this.$emit('updated');