18 changed files with 203 additions and 338 deletions
-
12app/assets/js/movim_rpc.js
-
54app/assets/js/movim_session.js
-
23app/models/sessionx/Sessionx.php
-
142app/models/sessionx/SessionxDAO.php
-
6app/widgets/Chat/Chat.php
-
29app/widgets/Feed/Feed.php
-
83app/widgets/Login/Login.php
-
2app/widgets/Node/node.tpl
-
9app/widgets/Poller/poller.js
-
6app/widgets/Presence/Presence.php
-
13app/widgets/System/System.php
-
2app/widgets/System/system.tpl
-
7bootstrap.php
-
2manifest.webapp
-
8system/RPC.php
-
114system/Sessionx.php
-
25system/User.php
-
4system/controllers/BaseController.php
@ -1,54 +0,0 @@ |
|||
/** |
|||
* Movim Session class. |
|||
* |
|||
* Implement an additional security to prevent same rid and id in the |
|||
* XMPP requests during the session |
|||
*/ |
|||
var Session = { |
|||
session: null, |
|||
init: function() { |
|||
this.session = localStorage.getItem('session'); |
|||
|
|||
if(this.session == "null" || this.session == null) { |
|||
this.clear(); |
|||
|
|||
localStorage.setItem('session', JSON.stringify(this.session)); |
|||
} else { |
|||
this.session = JSON.parse(this.session); |
|||
} |
|||
}, |
|||
|
|||
reset: function() { |
|||
localStorage.setItem('session', null); |
|||
}, |
|||
|
|||
check: function() { |
|||
if(SESSION_RID != null && SESSION_RID > this.session.rid) |
|||
this.session.rid = SESSION_RID; |
|||
if(SESSION_ID != null && SESSION_ID > this.session.id) |
|||
this.session.id = SESSION_ID; |
|||
}, |
|||
|
|||
clear: function() { |
|||
this.session = { |
|||
'id' : 0, |
|||
'rid' : 0 |
|||
}; |
|||
|
|||
localStorage.setItem('session', JSON.stringify(this.session)); |
|||
}, |
|||
|
|||
getSession: function() { |
|||
console.log('Increase '+this.session.rid); |
|||
this.init(); |
|||
this.check(); |
|||
this.session.id = this.session.id+1; |
|||
this.session.rid = this.session.rid+1; |
|||
|
|||
localStorage.setItem('session', JSON.stringify(this.session)); |
|||
|
|||
return this.session; |
|||
} |
|||
} |
|||
|
|||
Session.init(); |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue