goddamn it forgot this

This commit is contained in:
Evert Prants 2017-10-03 14:21:15 +03:00
parent e57341dbd9
commit fc78d3fdea
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 29 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import emailer from '../api/emailer'
import apiRouter from './api'
import oauthRouter from './oauth2'
import adminRouter from './admin'
import mcRouter from './minecraft'
let router = express.Router()
@ -739,6 +740,7 @@ router.get('/activate/:token', wrap(async (req, res) => {
router.use('/api', apiRouter)
router.use('/admin', adminRouter)
router.use('/mc', mcRouter)
/*
NO ROUTES BEYOND THIS POINT

View File

@ -0,0 +1,27 @@
import express from 'express'
import wrap from '../../scripts/asyncRoute'
import Minecraft from '../api/minecraft'
let router = express.Router()
router.get('/', wrap(async (req, res) => {
if (!req.session.user) {
req.session.redirectUri = req.originalUrl
return res.redirect('/login')
}
let token = await Minecraft.getToken(req.session.user)
res.render('minecraft/index', {token: token.token, mcu: token.mcu})
}))
router.post('/verify/', wrap(async (req, res) => {
if (!req.body.name || !req.body.uuid || !req.body.token) return res.status(400).jsonp({error: 'Missing field.'})
let verify = await Minecraft.verifyToken(req.body.token, req.body.name, req.body.uuid)
if (!verify) return res.status(400).jsonp({error: 'Already verified.'})
res.status(200).end()
}))
module.exports = router