overleaf/services/web/modules/user-activate/app/src/UserActivateRouter.js
Eric Mc Sween e0d91eaa26 Merge pull request #7906 from overleaf/em-downgrade-logs
Downgrade all INFO logs to DEBUG

GitOrigin-RevId: 05ed582ef0721fcada059f0ad158565f50feca27
2022-05-17 08:05:26 +00:00

30 lines
1 KiB
JavaScript

const logger = require('@overleaf/logger')
const UserActivateController = require('./UserActivateController')
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
const AuthorizationMiddleware = require('../../../../app/src/Features/Authorization/AuthorizationMiddleware')
module.exports = {
apply(webRouter) {
logger.debug({}, 'Init UserActivate router')
webRouter.get(
'/admin/user',
AuthorizationMiddleware.ensureUserIsSiteAdmin,
(req, res) => res.redirect('/admin/register')
)
webRouter.get('/user/activate', UserActivateController.activateAccountPage)
AuthenticationController.addEndpointToLoginWhitelist('/user/activate')
webRouter.get(
'/admin/register',
AuthorizationMiddleware.ensureUserIsSiteAdmin,
UserActivateController.registerNewUser
)
webRouter.post(
'/admin/register',
AuthorizationMiddleware.ensureUserIsSiteAdmin,
UserActivateController.register
)
},
}