Home

Issue: 706

Verification on the authorization(login) form

[issue link]

Good day. I’m doing a verification on the authorization form (example):

<input type="email"  required/>

Nuxt make rendering on the server side. Question: Does it make sense for me to validate the fields of the authorization form on the server side after sending data to the server? Or a second verification is superfluous?

(example on server)

registration.post('/', (req, res) => {
  validateInput(req.body).then(({ errors, isValid }) => {
    if (isValid) {      
      User.forge({
        username, email
      }).save()
        .then(user => res.json({ success: true }))
        .catch(err => res.status(500).json({ error: err }));
    } else {
      res.status(400).json(errors);
    }
  });
});
This question is available on Nuxt.js community (#c603)