|
@ -23,17 +23,24 @@ class WelcomeController extends SiteController { |
|
|
|
|
|
|
|
|
captcha.loadFont(path.join(this.dtp.config.root, 'client', 'fonts', 'Dirty Sweb.ttf')); |
|
|
captcha.loadFont(path.join(this.dtp.config.root, 'client', 'fonts', 'Dirty Sweb.ttf')); |
|
|
|
|
|
|
|
|
|
|
|
function preventUserAccess (req, res, next) { |
|
|
|
|
|
if (req.user) { |
|
|
|
|
|
return res.redirect(301, '/'); |
|
|
|
|
|
} |
|
|
|
|
|
return next(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const router = express.Router(); |
|
|
const router = express.Router(); |
|
|
this.dtp.app.use('/welcome', welcomeLimiter, async (req, res, next) => { |
|
|
this.dtp.app.use('/welcome', welcomeLimiter, async (req, res, next) => { |
|
|
res.locals.currentView = 'welcome'; |
|
|
res.locals.currentView = 'welcome'; |
|
|
return next(); |
|
|
return next(); |
|
|
}, router); |
|
|
}, router); |
|
|
|
|
|
|
|
|
router.get('/core-member', this.getWelcomeCoreMember.bind(this)); |
|
|
router.get('/core-member', preventUserAccess, this.getWelcomeCoreMember.bind(this)); |
|
|
router.get('/signup/captcha', this.getSignupCaptcha.bind(this)); |
|
|
router.get('/signup/captcha', this.getSignupCaptcha.bind(this)); |
|
|
router.get('/signup', this.getSignupView.bind(this)); |
|
|
router.get('/signup', preventUserAccess, this.getSignupView.bind(this)); |
|
|
router.get('/login', this.getLoginView.bind(this)); |
|
|
router.get('/login', preventUserAccess, this.getLoginView.bind(this)); |
|
|
router.get('/', this.getHomeView.bind(this)); |
|
|
router.get('/', preventUserAccess, this.getHomeView.bind(this)); |
|
|
|
|
|
|
|
|
return router; |
|
|
return router; |
|
|
} |
|
|
} |
|
|