Reset global state on logout

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the apps category.

Last Updated: 2021-05-16

In Project S, Y reported that globalState().stationOperator was true for their non-station-operator personal account. When I investigated, this occured because she had logged in as a station operator previously in the emulator, which set this boolean in globalState. When she later logged in as Y, this boolean was not cleared.

The general solution is to clear reset all global state on logout if possible. Or if not, to clear all credential related stuff.