Add session control and change redirection to current page when logging in.