mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
b290510faf
[web] Migrate `modules/user-activate` to ESM GitOrigin-RevId: e5ab3e9c53ea2d3f4ddfbc2200a889b8bb0db83c
30 lines
1,017 B
JavaScript
30 lines
1,017 B
JavaScript
import logger from '@overleaf/logger'
|
|
import UserActivateController from './UserActivateController.mjs'
|
|
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.js'
|
|
import AuthorizationMiddleware from '../../../../app/src/Features/Authorization/AuthorizationMiddleware.js'
|
|
|
|
export default {
|
|
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
|
|
)
|
|
},
|
|
}
|