message: feat(server): add use verification rest endpoint
diff: const appRoot = require('app-root-path')
  +const knex = require(`${appRoot}/db/knex`)
  +
  const { getUserByEmail } = require(`${appRoot}/modules/core/services/users`)
  -const { matomoMiddleware } = require(`${appRoot}/logging/matomoHelper`)
  const { contextMiddleware } = require(`${appRoot}/modules/shared`)
  const { sendEmailVerification } = require('../services/verification')
  +const Verifications = () => knex('email_verifications')
  +const Users = () => knex('users')
  +
  module.exports = (app) => {
  // send email verification
  @@ -33,4 +37,26 @@ module.exports = (app) => {
  return res.status(500).send(error.message)
  }
  })
  +
  + app.get('/auth/verifyemail', async (req, res, __) => {
  +
  + if (!req.query.t) return res.status(400).send('No verification token set.')
  +
  + const verification = await Verifications().where({ id: req.query.t }).first()
  + if (!verification)
  + return res.status(404).send('No verification with this token.')
  +
  + const timeDiff = Math.abs(Date.now() - new Date(verification.createdAt))
  + if (timeDiff > 8.64e+7)
  + return res
  + .status(400)
  + .send('Verification expired, please request a new one.')
  +
  + await Users()
  + .where({ email: verification.email })
  + .update({ verified: true })
  + await Verifications().where({ id: req.query.t }).del()
  +
  + return res.redirect('/')
  + })
  }
  \ No newline at end of file
  