From 5f72f135281978deee4c6cd3188d6e19795881cd Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 9 Apr 2014 12:26:59 +0100 Subject: [PATCH] moved password reset to user pages controller --- .../coffee/Features/User/UserPagesController.coffee | 4 +++- .../web/app/coffee/controllers/UserController.coffee | 4 +--- services/web/app/coffee/router.coffee | 2 +- .../coffee/User/UserPagesControllerTests.coffee | 10 ++++++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/services/web/app/coffee/Features/User/UserPagesController.coffee b/services/web/app/coffee/Features/User/UserPagesController.coffee index e5b42ae9b7..a3398c0b70 100644 --- a/services/web/app/coffee/Features/User/UserPagesController.coffee +++ b/services/web/app/coffee/Features/User/UserPagesController.coffee @@ -23,4 +23,6 @@ module.exports = title: 'Login', redir: req.query.redir - + passwordResetPage : (req, res)-> + res.render 'user/passwordReset', + title: 'Password Reset', \ No newline at end of file diff --git a/services/web/app/coffee/controllers/UserController.coffee b/services/web/app/coffee/controllers/UserController.coffee index 3085972be7..1ef6706ba4 100644 --- a/services/web/app/coffee/controllers/UserController.coffee +++ b/services/web/app/coffee/controllers/UserController.coffee @@ -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) diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index bca4499637..9ec34d0497 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -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 diff --git a/services/web/test/UnitTests/coffee/User/UserPagesControllerTests.coffee b/services/web/test/UnitTests/coffee/User/UserPagesControllerTests.coffee index 74cf9a5ced..589272487b 100644 --- a/services/web/test/UnitTests/coffee/User/UserPagesControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/User/UserPagesControllerTests.coffee @@ -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 + +