2019-05-29 05:21:06 -04:00
|
|
|
const PasswordResetController = require('./PasswordResetController')
|
|
|
|
const AuthenticationController = require('../Authentication/AuthenticationController')
|
2021-02-03 07:37:16 -05:00
|
|
|
const { Joi, validate } = require('../../infrastructure/Validation')
|
2019-05-29 05:21:06 -04:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
apply(webRouter, apiRouter) {
|
|
|
|
webRouter.get(
|
|
|
|
'/user/password/reset',
|
|
|
|
PasswordResetController.renderRequestResetForm
|
|
|
|
)
|
2021-02-03 07:37:16 -05:00
|
|
|
webRouter.post(
|
|
|
|
'/user/password/reset',
|
|
|
|
validate({
|
|
|
|
body: Joi.object({
|
2021-04-27 03:52:58 -04:00
|
|
|
email: Joi.string().required(),
|
|
|
|
}),
|
2021-02-03 07:37:16 -05:00
|
|
|
}),
|
|
|
|
PasswordResetController.requestReset
|
|
|
|
)
|
2019-05-29 05:21:06 -04:00
|
|
|
AuthenticationController.addEndpointToLoginWhitelist('/user/password/reset')
|
|
|
|
|
|
|
|
webRouter.get(
|
|
|
|
'/user/password/set',
|
|
|
|
PasswordResetController.renderSetPasswordForm
|
|
|
|
)
|
|
|
|
webRouter.post(
|
|
|
|
'/user/password/set',
|
2021-02-03 07:37:16 -05:00
|
|
|
validate({
|
|
|
|
body: Joi.object({
|
|
|
|
password: Joi.string().required(),
|
2021-04-27 03:52:58 -04:00
|
|
|
passwordResetToken: Joi.string().required(),
|
|
|
|
}),
|
2021-02-03 07:37:16 -05:00
|
|
|
}),
|
2019-05-29 05:21:06 -04:00
|
|
|
PasswordResetController.setNewUserPassword
|
|
|
|
)
|
|
|
|
AuthenticationController.addEndpointToLoginWhitelist('/user/password/set')
|
|
|
|
|
2021-02-03 07:37:16 -05:00
|
|
|
webRouter.post(
|
|
|
|
'/user/reconfirm',
|
|
|
|
validate({
|
|
|
|
body: Joi.object({
|
2021-04-27 03:52:58 -04:00
|
|
|
email: Joi.string().required(),
|
|
|
|
}),
|
2021-02-03 07:37:16 -05:00
|
|
|
}),
|
|
|
|
PasswordResetController.requestReset
|
|
|
|
)
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2019-05-29 05:21:06 -04:00
|
|
|
}
|