clear login token when deleting your account and before logging in

This commit is contained in:
ansuz 2021-08-10 18:46:10 +05:30
parent a33774aa6f
commit d960c10a31
4 changed files with 14 additions and 5 deletions

View File

@ -463,6 +463,7 @@ define([
var proceed = function (result) { var proceed = function (result) {
hashing = false; hashing = false;
if (test && typeof test === "function" && test()) { return; } if (test && typeof test === "function" && test()) { return; }
LocalStore.clearLoginToken();
Realtime.whenRealtimeSyncs(result.realtime, function () { Realtime.whenRealtimeSyncs(result.realtime, function () {
Exports.redirect(); Exports.redirect();
}); });

View File

@ -82,6 +82,10 @@ define([
} catch (err) { return; } } catch (err) { return; }
}; };
LocalStore.clearLoginToken = function () {
localStorage.removeItem(Constants.loginToken);
};
LocalStore.setDriveRedirectPreference = function (bool) { LocalStore.setDriveRedirectPreference = function (bool) {
localStorage.setItem(Constants.redirectToDriveKey, Boolean(bool)); localStorage.setItem(Constants.redirectToDriveKey, Boolean(bool));
}; };

View File

@ -542,12 +542,12 @@ define([
} }
// Owned drive // Owned drive
if (data.state === true) { if (data.state === true) {
sframeChan.query('Q_SETTINGS_LOGOUT', null, function() {}); return void sframeChan.query('Q_SETTINGS_LOGOUT_PROPERLY', null, function() {
UI.alert(Messages.settings_deleted, function() { UI.alert(Messages.settings_deleted, function() {
common.gotoURL('/'); common.gotoURL('/');
});
spinner.done();
}); });
spinner.done();
return;
} }
// Not owned drive // Not owned drive
var msg = h('div.cp-app-settings-delete-alert', [ var msg = h('div.cp-app-settings-delete-alert', [

View File

@ -57,6 +57,10 @@ define([
}); });
}); });
}); });
sframeChan.on('Q_SETTINGS_LOGOUT_PROPERLY', function (data, cb) {
Utils.LocalStore.clearLoginToken();
cb();
});
sframeChan.on('Q_SETTINGS_DRIVE_RESET', function (data, cb) { sframeChan.on('Q_SETTINGS_DRIVE_RESET', function (data, cb) {
Cryptpad.resetDrive(cb); Cryptpad.resetDrive(cb);
}); });