mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
moved password reset to user pages controller
This commit is contained in:
parent
434fca8874
commit
5f72f13528
4 changed files with 15 additions and 5 deletions
|
@ -23,4 +23,6 @@ module.exports =
|
|||
title: 'Login',
|
||||
redir: req.query.redir
|
||||
|
||||
|
||||
passwordResetPage : (req, res)->
|
||||
res.render 'user/passwordReset',
|
||||
title: 'Password Reset',
|
|
@ -68,9 +68,7 @@ module.exports =
|
|||
to: user.email
|
||||
EmailHandler.sendEmail "welcome", emailOpts
|
||||
|
||||
requestPasswordReset : (req, res)->
|
||||
res.render 'user/passwordReset',
|
||||
title: 'Password Reset',
|
||||
|
||||
|
||||
doRequestPasswordReset : (req, res, next = (error) ->)->
|
||||
email = sanitize.escape(req.body.email)
|
||||
|
|
|
@ -77,7 +77,7 @@ module.exports = class Router
|
|||
app.get '/user/settings', AuthenticationController.requireLogin(), UserController.settings
|
||||
app.post '/user/settings', AuthenticationController.requireLogin(), UserController.apiUpdate
|
||||
app.post '/user/password/update', AuthenticationController.requireLogin(), UserController.changePassword
|
||||
app.get '/user/passwordreset', UserController.requestPasswordReset
|
||||
app.get '/user/passwordreset', UserPagesController.passwordResetPage
|
||||
app.post '/user/passwordReset', UserController.doRequestPasswordReset
|
||||
app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe
|
||||
app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser
|
||||
|
|
|
@ -78,3 +78,13 @@ describe "UserPagesController", ->
|
|||
opts.redir.should.equal redirect
|
||||
done()
|
||||
@UserPagesController.loginPage @req, @res
|
||||
|
||||
describe "passwordResetPage", ->
|
||||
|
||||
it "should render the login page", (done)->
|
||||
@res.render = (page)=>
|
||||
page.should.equal "user/passwordReset"
|
||||
done()
|
||||
@UserPagesController.passwordResetPage @req, @res
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue