colinskow / ng-superlogin

AngularJS bindings for the SuperLogin project
MIT License
15 stars 17 forks source link

Getting a possibile false 'sl:login' event? #9

Open micky2be opened 8 years ago

micky2be commented 8 years ago

On the following https://github.com/colinskow/ng-superlogin/blob/master/src/ng-superlogin.js#L63 it looks like 'sl:login' will trigger if there is a session in localStorage, without knowing if the session is valid or not.

checkExpired(); might be trigger few lines later (if configured) which may or may not trigger a 'sl:logout'.

It seems a bit risky and may create some weird behavior UI wise depending of the implementation.

Also, nothing guaranty at that time that the session is still valid on the server side. Calling an special endpoint (see https://github.com/colinskow/superlogin/issues/53) could help.