One more auth system that will give you nightmares...

This JavaScript code powers a 1,500 user intranet application.

The longer you look at it the more insane it gets.

@LoganDice Why are there 3 ='s for the logic tests?

(yes, there is a LOT more here....)
@kemonine @LoganDice actually, `===` is usually a good idea because you avoid accidental type conversions.
@kemonine In JavaScript, `==` performs coercions so that e.g. `2 == "2"` is true. The `===` doesn't, acting much more like `==` in other C-derived languages.