mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 15:00:48 +00:00
30 lines
No EOL
849 B
CoffeeScript
30 lines
No EOL
849 B
CoffeeScript
PasswordResetHandler = require("./PasswordResetHandler")
|
|
|
|
module.exports =
|
|
|
|
renderRequestResetForm: (req, res)->
|
|
res.render "user/passwordReset",
|
|
title:"Reset Password"
|
|
|
|
requestReset: (req, res)->
|
|
email = req.body.email.trim()
|
|
PasswordResetHandler.generateAndEmailResetToken email, (err)->
|
|
if err?
|
|
res.send 500
|
|
else
|
|
res.send 200
|
|
|
|
renderSetPasswordForm: (req, res)->
|
|
res.render "user/setPassword",
|
|
title:"Set Password"
|
|
passwordResetToken:req.query.passwordResetToken
|
|
|
|
setNewUserPassword: (req, res)->
|
|
{passwordResetToken, password} = req.body
|
|
if !password? or password.length < 4 or !passwordResetToken? or passwordResetToken.length == 0
|
|
return res.send 500
|
|
PasswordResetHandler.setNewUserPassword passwordResetToken?.trim(), password?.trim(), (err)->
|
|
if err?
|
|
res.send 500
|
|
else
|
|
res.send 200 |