Move Popup close code from HTML page to AuthentificationController (saves 1 redirect)