update_username(req, res){
        if(req.body.username.length > 2 && req.body.username.length <= 16){

            // update in all messages too
            this.parent.room.messages.forEach(message => {
                if(message.username == req.session.user.username){
                    message.username = req.body.username;
                }                
            });

            req.session.user.username = req.body.username;

            return true;
        }
        else{
            return false;
        }
    }
// Saves users username (POST)
Saves users username (POST)
Saves users username ( POST )
update_username(req, res){
        if(req.body.username.length > 2 && req.body.username.length <= 16){
            this.parent.room.messages.forEach(message => {
                if(message.username == req.session.user.username){
                    message.username = req.body.username;
                }                
            });
            req.session.user.username = req.body.username;
            return true;
        }
        else{
            return false;
        }
    }
update_username ( req , res ) { if ( req . body . username . length > 2 && req . body . username . length <= 16 ) { this . parent . room . messages . forEach ( message => { if ( message . username == req . session . user . username ) { message . username = req . body . username ; } } ) ; req . session . user . username = req . body . username ; return true ; } else { return false ; } }
Saves users username (POST)
Saves users username ( POST )
// update in all messages too