This code ignores requirements of the task "after authentication user should be redirected to page he originally tried to open"!