Fix for #1144; $caneditdomain get lost when security_questions are raised

New try for pull requests, this time with branches.
Others will follow.
Please give feedback whether this is better or if I still have to to it another way.
Benjamin