Fixed #18161 changing the determination of redirect url in admin login

Changed the logic for determination of the redirect URL in admin login to match the logic in the login view, as proposed by andrewgodwin in the ticket #18161