if nodebb returns 403/404, don't overwrite previousUrl. If you don't do this, when logging in after a 403/404, it will redirect you to the 403/404 page.
Fixes a small issue with the redirect after logging in. If app.previousUrl is undefined (from accessing the page directly), login would fail to redirect you because of an error with indexOf on the undefined app.previousUrl.
just changed the 403/404 checking logic to use regex.
Merge pull request #386 from adarqui/issue-login-redirect-40x

Issue login redirect 40x