File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ class Dashboard extends Component {
241241
242242 removeAsAdmin = ( userId ) => {
243243 const { user } = this . props ;
244+ console . log ( 'about to force logout' , userId , user . _id ) ;
244245 socket . emit ( 'FORCE_LOGOUT' , userId , user . _id ) ;
245246 this . _buttonAction ( ( ) => API . removeAsAdmin ( userId ) , userId , {
246247 isAdmin : false ,
@@ -250,6 +251,7 @@ class Dashboard extends Component {
250251
251252 makeAdmin = ( userId ) => {
252253 const { user } = this . props ;
254+ console . log ( 'about to force logout' , userId , user . _id ) ;
253255 socket . emit ( 'FORCE_LOGOUT' , userId , user . _id ) ;
254256 this . _buttonAction ( ( ) => API . makeAdmin ( userId ) , userId , {
255257 isAdmin : true ,
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ module.exports = function() {
232232
233233 // implement a tiny bit of authentication: requestor must be an admin
234234 socket . on ( 'FORCE_LOGOUT' , async ( userId , requestingId ) => {
235- if ( ! userId ) return ;
235+ if ( ! userId || userId === requestingId ) return ;
236236 const requestor = await controllers . user . getById ( requestingId ) ;
237237 if ( requestor && requestor . isAdmin ) await forceLogout ( userId ) ;
238238 } ) ;
You can’t perform that action at this time.
0 commit comments