From 5dadac51b65c714e2235f28c000a646716e2a63a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 12 Dec 2017 05:59:14 +0100 Subject: also make mailboxes --- bucky/util/auth.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'bucky/util') diff --git a/bucky/util/auth.js b/bucky/util/auth.js index 548ffcc..dd3df6f 100644 --- a/bucky/util/auth.js +++ b/bucky/util/auth.js @@ -56,6 +56,29 @@ var auth = module.exports = { } db.createUser(data).then(() => next()) }, + function (req, res, next) { + var username = req.user.get('username') + Promise.all([ + db.createMailbox({ + mbox: username + '.inbox', + owner: username, + mcount: 0, + editable: 0, + }), + db.createMailbox({ + mbox: username + '.outbox', + owner: username, + mcount: 0, + editable: 0, + }), + db.createMailbox({ + mbox: username + '.drafts', + owner: username, + mcount: 0, + editable: 1, + }), + ]).then(() => next()) + }, passport.authenticate("local"), auth.login) app.put("/api/login", -- cgit v1.2.3-70-g09d2