the `var self = this` is an idiom from passportjs.
This line should go before the if though and the `this.fail` should be replaced with `self.fail`