jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
697 B

'use strict';
const { Boards, Accounts } = require(__dirname+'/../../db/');
module.exports = async (req, res, next) => {
const newOwner = await Accounts.findOne(req.body.username);
if (!newOwner) {
return res.status(400).render('message', {
'title': 'Bad request',
'message': 'Cannot transfer to account that does not exist',
'redirect': `/${req.params.board}/manage/settings.html`
});
}
//set owner in memory and in db
res.locals.board.owner = newOwner._id;
await Boards.setOwner(req.params.board, res.locals.board.owner);
return res.render('message', {
'title': 'Success',
'message': 'Transferred ownership',
'redirect': `/${req.params.board}/index.html`
});
}