overleaf/services/web/app/src/Features/PasswordReset/PasswordResetRouter.js
Alf Eaton 1be43911b4 Merge pull request #3942 from overleaf/prettier-trailing-comma
Set Prettier's "trailingComma" setting to "es5"

GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
2021-04-28 02:10:01 +00:00

48 lines
1.3 KiB
JavaScript

const PasswordResetController = require('./PasswordResetController')
const AuthenticationController = require('../Authentication/AuthenticationController')
const { Joi, validate } = require('../../infrastructure/Validation')
module.exports = {
apply(webRouter, apiRouter) {
webRouter.get(
'/user/password/reset',
PasswordResetController.renderRequestResetForm
)
webRouter.post(
'/user/password/reset',
validate({
body: Joi.object({
email: Joi.string().required(),
}),
}),
PasswordResetController.requestReset
)
AuthenticationController.addEndpointToLoginWhitelist('/user/password/reset')
webRouter.get(
'/user/password/set',
PasswordResetController.renderSetPasswordForm
)
webRouter.post(
'/user/password/set',
validate({
body: Joi.object({
password: Joi.string().required(),
passwordResetToken: Joi.string().required(),
}),
}),
PasswordResetController.setNewUserPassword
)
AuthenticationController.addEndpointToLoginWhitelist('/user/password/set')
webRouter.post(
'/user/reconfirm',
validate({
body: Joi.object({
email: Joi.string().required(),
}),
}),
PasswordResetController.requestReset
)
},
}