Review pr2321

I like this way of proceeding, checking for the app (in just one request) before proceeding with the auth brute. Saves one request while checking, and the resultant code is readable and review-friendly I think. Feel free to review, test, discuss, etc and land once you feel comfortable with it! The original pull request will be automatically updated!