From 5d5d546d25e9200c422133ff5d481b91ff9b500a Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Tue, 7 Jan 2014 14:13:35 -0500 Subject: [PATCH] Refactoring --- app.js | 4 ++-- controllers/user.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 3049b5c01cf..ff24b6bd34e 100755 --- a/app.js +++ b/app.js @@ -95,8 +95,8 @@ if (cluster.isMaster) { app.get('/contact', contactController.getContact); app.post('/contact', contactController.postContact); app.get('/account', passportConf.isAuthenticated, userController.getAccount); - app.post('/account/profile', passportConf.isAuthenticated, userController.postAccountProfileTab); - app.post('/account/settings', passportConf.isAuthenticated, userController.postAccountSettingsTab); + app.post('/account/profile', passportConf.isAuthenticated, userController.postUpdateProfile); + app.post('/account/password', passportConf.isAuthenticated, userController.postUpdatePassword); app.post('/account/delete', passportConf.isAuthenticated, userController.postDeleteAccount); app.get('/account/unlink/:provider', passportConf.isAuthenticated, userController.getOauthUnlink); app.get('/api', apiController.getApi); diff --git a/controllers/user.js b/controllers/user.js index 4e35eac1329..c14f655fd26 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -7,7 +7,7 @@ var User = require('../models/User'); /** * GET /account - * User account page + * User account page. */ exports.getAccount = function(req, res) { res.render('account/profile', { @@ -18,10 +18,10 @@ exports.getAccount = function(req, res) { }; /** - * POST /account#profile - * Update user's profile information + * POST /account/profile + * Update profile information. */ -exports.postAccountProfileTab = function(req, res, next) { +exports.postUpdateProfile = function(req, res, next) { User.findById(req.user.id, function(err, user) { if (err) return next(err); @@ -40,10 +40,10 @@ exports.postAccountProfileTab = function(req, res, next) { }; /** - * POST /account#settings - * Update user's current password + * POST /account/password + * Update current password. */ -exports.postAccountSettingsTab = function(req, res, next) { +exports.postUpdatePassword = function(req, res, next) { // TODO: Use Virtuals (mongoose) if (!req.body.password || !req.body.confirm.password) { @@ -69,7 +69,7 @@ exports.postAccountSettingsTab = function(req, res, next) { /** * POST /account/delete - * Delete user's account + * Delete user account. */ exports.postDeleteAccount = function(req, res, next) { User.remove({ _id: req.user.id }, function(err) {