mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
refactoring register to use form post instead of socket (for passport integration)
This commit is contained in:
@@ -164,6 +164,20 @@ passport.deserializeUser(function(uid, done) {
|
||||
res.send(templates['header'] + templates['register'] + templates['footer']);
|
||||
});
|
||||
|
||||
app.post('/register', function(req, res) {
|
||||
global.modules.user.create(req.body.username, req.body.password, req.body.email, function(err, uid) {
|
||||
if (err === null) {
|
||||
req.login({
|
||||
uid: uid
|
||||
}, function() {
|
||||
res.redirect('/');
|
||||
});
|
||||
} else {
|
||||
res.redirect('/register');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/account', function(req, res) {
|
||||
refreshTemplates();
|
||||
res.send(templates['header'] + templates['account_settings'] + templates['footer']);
|
||||
|
||||
Reference in New Issue
Block a user