diff --git a/server/app.js b/server/app.js index 3b6c7eac0..7f0793a4a 100644 --- a/server/app.js +++ b/server/app.js @@ -375,16 +375,12 @@ app.put('/api/user/rename', async (req, res)=>{ //Delete brews based on author app.delete('/api/user/delete', async (req, res)=>{ const { username } = req.body; - console.log('username: ', username); - if(!username) return res.status(400).json({ error: 'Username is required.' }); - - //const ownAccount = req.account && (req.account.username == username); - //if(!ownAccount) return res.status(403).json({ error: 'Must be logged in to change your username' }); + const ownAccount = req.account && (req.account.username == username); + if(!ownAccount) return res.status(403).json({ error: 'Must be logged in to delete your account' }); try { const brews = await HomebrewModel.getByUser(username, true, ['_id', 'googleId', 'editId', 'authors']); - console.log('brews: ', brews); const deletePromises = brews.map((brew)=>{ req.brew = brew; @@ -393,7 +389,6 @@ app.delete('/api/user/delete', async (req, res)=>{ }); }); - console.log('delete promises: ', deletePromises); await Promise.all(deletePromises); return res.json({ success: true, message: `All brews for ${username} have been deleted.` }); diff --git a/server/homebrew.api.js b/server/homebrew.api.js index da4fe3f06..aa80e9a61 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -439,7 +439,6 @@ const api = { let brew = req.brew; const { googleId, editId } = brew; const account = req.account; - //if in local, may test this with: const account = req.account || { username: 'a' }; const isOwner = account && (brew.authors.length === 0 || brew.authors[0] === account.username); // If the user is the owner and the file is saved to google, mark the google brew for deletion const shouldDeleteGoogleBrew = googleId && isOwner;