contribution fix

-add destroy session
This commit is contained in:
Danil Kovtonyuk 2020-02-07 01:32:24 +10:00
parent 29387ac20c
commit aa8d72923c
2 changed files with 7 additions and 2 deletions

View File

@ -63,4 +63,8 @@ router.get('/twitter_callback', (req, res) => {
)
})
router.get('/logout', (req, res) => {
req.session.destroy()
})
module.exports = router

View File

@ -13,8 +13,9 @@ module.exports = (sequelize, DataTypes) => {
{
hooks: {
beforeCreate: (contribution, options) => {
const { name, company } = contribution.dataValues
if (name.length < 4 || name.length > 35) {
console.log('contribution', contribution.dataValues)
const { name, company, socialType } = contribution.dataValues
if (socialType !== 'anonymous' && (name.length < 4 || name.length > 35)) {
throw new Error('Wrong name')
}
if (company && company.length > 35) {