Handling of 'next' url for redirection after successful login

Passing a "next" parameter to the /login url (e.g. [localhost:5000/login?next=http%3A%2F%2Fexample.com](http://localhost:5000/login?next=http%3A%2F%2Fexample.com)) cause the user to be redirect to the given location after a successful login. If a wrong token is passed the user is redirected to the default url.