nl_tokens: Lookup user by username
pl_tokens: function ( token , done ) { if ( req . body . username ) { User . findOne ( { username : req . body . username } , '-salt -password' , function ( err , user ) { if ( ! user ) { return res . status ( 400 ) . send ( { message : 'No account with that username has been found' } ) ; } else if ( user . provider !== 'local' ) { return res . status ( 400 ) . send ( { message : 'It seems like you signed up using your ' + user . provider + ' account' } ) ; } else { user . resetPasswordToken = token ; user . resetPasswordExpires = Date . now ( ) + 3600000 ; // 1 hour user . save ( function ( err ) { done ( err , token , user ) ; } ) ; } } ) ; } else { return <mask> . status ( 400 ) . send ( { message : 'Username field must not be blank' } ) ; } }