moved password reset to user pages controller

This commit is contained in:
Henry Oswald 2014-04-09 12:26:59 +01:00
parent 434fca8874
commit 5f72f13528
4 changed files with 15 additions and 5 deletions

View file

@ -23,4 +23,6 @@ module.exports =
title: 'Login', title: 'Login',
redir: req.query.redir redir: req.query.redir
passwordResetPage : (req, res)->
res.render 'user/passwordReset',
title: 'Password Reset',

View file

@ -68,9 +68,7 @@ module.exports =
to: user.email to: user.email
EmailHandler.sendEmail "welcome", emailOpts EmailHandler.sendEmail "welcome", emailOpts
requestPasswordReset : (req, res)->
res.render 'user/passwordReset',
title: 'Password Reset',
doRequestPasswordReset : (req, res, next = (error) ->)-> doRequestPasswordReset : (req, res, next = (error) ->)->
email = sanitize.escape(req.body.email) email = sanitize.escape(req.body.email)

View file

@ -77,7 +77,7 @@ module.exports = class Router
app.get '/user/settings', AuthenticationController.requireLogin(), UserController.settings app.get '/user/settings', AuthenticationController.requireLogin(), UserController.settings
app.post '/user/settings', AuthenticationController.requireLogin(), UserController.apiUpdate app.post '/user/settings', AuthenticationController.requireLogin(), UserController.apiUpdate
app.post '/user/password/update', AuthenticationController.requireLogin(), UserController.changePassword 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.post '/user/passwordReset', UserController.doRequestPasswordReset
app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe
app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser

View file

@ -78,3 +78,13 @@ describe "UserPagesController", ->
opts.redir.should.equal redirect opts.redir.should.equal redirect
done() done()
@UserPagesController.loginPage @req, @res @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