Fixes issue with unvalidated redirects in next parameter

Currently the next query parameter allows for unvalidated redirects. An attacker can send a link to an user containing a complete URL, such as  "http://maritini.com/logout?next=http://evil.com". Since next is not validated, the user will be sent to "http://evil.com". 

To solve this I added an extractPath function which attempts to parse the next variable and return it's Path. If there is an error parsing it returns "/"