text: function onlyUsers(req, res, next) {
      if (!req.session.userId)
          return res.redirect("/login")
  
      next()
  }
  
  function isLoggedRedirectToProfile(req, res, next) {
      if (req.session.userId)
          return res.redirect('/admin/profile')
  
      next()
  }
  
  function onlyAdmin (req, res, next) {
      if (req.admin == false) {
          return res.redirect('/admin/profile')
      }
  
      next()
  }
  
  module.exports = {
      onlyUsers,
      isLoggedRedirectToProfile,
      onlyAdmin
  }