start actually using "keep-logged-in"
This commit is contained in:
+7
-3
@@ -3798,7 +3798,10 @@
|
|||||||
Tinode.onConnect = this.handleConnected;
|
Tinode.onConnect = this.handleConnected;
|
||||||
Tinode.onDisconnect = this.handleDisconnect;
|
Tinode.onDisconnect = this.handleDisconnect;
|
||||||
this.tnSetup(this.state.serverAddress, this.state.transport);
|
this.tnSetup(this.state.serverAddress, this.state.transport);
|
||||||
var token = localStorage.getObject("auth-token");
|
var token;
|
||||||
|
if (localStorage.getObject("keep-logged-in")) {
|
||||||
|
token = localStorage.getObject("auth-token");
|
||||||
|
}
|
||||||
if (token) {
|
if (token) {
|
||||||
// When reading from storage, date is returned as string.
|
// When reading from storage, date is returned as string.
|
||||||
token.expires = new Date(token.expires);
|
token.expires = new Date(token.expires);
|
||||||
@@ -3940,8 +3943,9 @@
|
|||||||
instance.handleError("", null);
|
instance.handleError("", null);
|
||||||
|
|
||||||
// Refresh authentication token.
|
// Refresh authentication token.
|
||||||
localStorage.setObject("auth-token", Tinode.getAuthToken());
|
if (localStorage.getObject("keep-logged-in")) {
|
||||||
|
localStorage.setObject("auth-token", Tinode.getAuthToken());
|
||||||
|
}
|
||||||
// Logged in fine, subscribe to 'me' attaching callbacks from the contacts view.
|
// Logged in fine, subscribe to 'me' attaching callbacks from the contacts view.
|
||||||
var me = Tinode.getMeTopic();
|
var me = Tinode.getMeTopic();
|
||||||
me.onMetaDesc = instance.tnMeMetaDesc;
|
me.onMetaDesc = instance.tnMeMetaDesc;
|
||||||
|
|||||||
Reference in New Issue
Block a user