When toggling Two Factor Authentication, it often takes a few tries to get it to work.
The toggle function ends up reloading the page in two different places, effectively creating a race condition.
This fixes that problem
(cherry picked from commit 6b9fc897bc02ff857a968e76ed49f1b0f2108bb5)
Adds a new javascript parameter that holds the webroot of the app. This
allows the the javascript calls to properly identify that they're
running in a subfolder/different webroot and direct their queries there.