How to develop with Cooldown with Express-Session

Hello, I am developing a feedback submission system. The person fills in some data, sends and saves in the database. However, for safety reasons, I wanted to create a cooldown so that the person only sends another feedback after 24 hours for example. I tried to do creating sessions, but none that worked properly. Anyone have an idea?

Controller:

router.post('/send-feedback', (req, res) => {

    const { name, email, description } = req.body

    Feedback.create({
        client_name: name,
        client_email: email,
        client_feedback: description
    }).then(() => {

        req.flash('success', 'Muito obrigado pelo Feedback, é muito importante para mim!')
        return res.redirect('/feedback')

    })


})```
Author: Carlos, 2020-12-29

1 answers

The safest ai, is you save in the bank when it was the last time the person (email) sent a feedback. before accepting, you check if it has been more than 24 hours, since the last registration of that person in the base.

With session is not cool, as it can delete cookies, use another device, etc.

 0
Author: William Bruno Rocha Moraes, 2021-01-26 10:44:32