Improved the redirection when successful login

If the login url parameter has a 'back' parameter, the redirection url
is filtered to relative path and made sure that the path begins with one
of the 5 components.

Change-Id: Id3d2af1496eb395061b8bf2c2664ec1ec221d11e