@@ -26,22 +26,28 @@ qx.Class.define("osparc.auth.Manager", {
2626 extend : qx . core . Object ,
2727 type : "singleton" ,
2828
29- /*
30- *****************************************************************************
31- EVENTS
32- *****************************************************************************
33- */
29+ construct : function ( ) {
30+ // TODO: how to store this locally?? See http://www.qooxdoo.org/devel/pages/data_binding/stores.html#offline-store
31+ // TODO: check if expired??
32+ // TODO: request server if token is still valid (e.g. expired, etc)
33+ const authData = osparc . auth . Data . getInstance ( ) ;
34+ authData . bind ( "auth" , this , "loggedIn" , {
35+ converter : auth => auth !== null && auth instanceof osparc . io . request . authentication . Token
36+ } ) ;
37+ } ,
3438
3539 events : {
3640 "loggedOut" : "qx.event.type.Event"
3741 } ,
3842
39-
40- /*
41- *****************************************************************************
42- MEMBERS
43- *****************************************************************************
44- */
43+ properties : {
44+ loggedIn : {
45+ check : "Boolean" ,
46+ nullable : false ,
47+ init : false ,
48+ event : "changeLoggedIn" ,
49+ }
50+ } ,
4551
4652 members : {
4753 register : function ( userData ) {
@@ -129,14 +135,6 @@ qx.Class.define("osparc.auth.Manager", {
129135 return osparc . data . Resources . fetch ( "auth" , "resendCode" , params ) ;
130136 } ,
131137
132- isLoggedIn : function ( ) {
133- // TODO: how to store this locally?? See http://www.qooxdoo.org/devel/pages/data_binding/stores.html#offline-store
134- // TODO: check if expired??
135- // TODO: request server if token is still valid (e.g. expired, etc)
136- const auth = osparc . auth . Data . getInstance ( ) . getAuth ( ) ;
137- return auth !== null && auth instanceof osparc . io . request . authentication . Token ;
138- } ,
139-
140138 /*
141139 * Function that checks if there is a token and validates it against the server.
142140 */
0 commit comments