Implemented Delete account feature
This commit is contained in:
3
app.js
3
app.js
@ -23,7 +23,7 @@ var db = mongoose.connect(config.db);
|
||||
var app = express();
|
||||
|
||||
// Express Configuration
|
||||
app.set('port', process.env.PORT || 3000);
|
||||
app.set('port', process.env.PORT || 5000);
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
app.use(express.favicon());
|
||||
@ -57,6 +57,7 @@ app.post('/signup', user.postSignup);
|
||||
app.get('/account', passportConf.isAuthenticated, user.getAccount);
|
||||
app.post('/account/profile', passportConf.isAuthenticated, user.postAccountProfile);
|
||||
app.post('/account/settings', passportConf.isAuthenticated, user.postAccountSettings);
|
||||
app.post('/account/delete', passportConf.isAuthenticated, user.deleteAccount);
|
||||
|
||||
app.get('/api', api.getApi);
|
||||
app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, api.getFoursquare);
|
||||
|
@ -32,6 +32,13 @@ exports.postAccountSettings = function(req, res) {
|
||||
console.log('okay!!');
|
||||
};
|
||||
|
||||
exports.deleteAccount = function(req, res) {
|
||||
User.remove({ _id: req.user.id }, function(err) {
|
||||
req.logout();
|
||||
res.redirect('/');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /login
|
||||
*/
|
||||
|
@ -56,7 +56,8 @@ block content
|
||||
.page-header
|
||||
h3 Delete Account
|
||||
p You can delete your account, but keep in mind this action is irreversiable.
|
||||
a.btn.btn-danger-outline(href='#') Delete my account
|
||||
form(action='/account/delete', method='POST')
|
||||
button.btn.btn-danger(type='submit') Delete my account
|
||||
|
||||
.page-header
|
||||
h3 Linked Accounts
|
||||
|
Reference in New Issue
Block a user