Detecting user already logged in when using SSO

Hi, I have implemented one very simplistic workaround for the case of linking discourse from the main site. Just changed the link to /login only for logged in users. If the user is logged in in our site and is not logged in discourse, it causes discourse to reload immediately and the user is then logged in via SSO. If the user was already logged in in discourse, there will be no page reload whatsoever.

This however does not cover the case when you need to link to specific page in discourse (maybe some redirectUrl parameter would solve this) and the case you came to discourse directly or from other site.