Merge pull request #2272 from bromagosa/fix-non-persistent-login

fixes non persistent login accross page reloads
pull/89/head
Jens Mönig 2018-11-29 13:16:59 +01:00 zatwierdzone przez GitHub
commit 2e043428e0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 31 dodań i 21 usunięć

Wyświetl plik

@ -273,29 +273,36 @@ IDE_Morph.prototype.init = function (isAutoFill) {
IDE_Morph.prototype.openIn = function (world) {
var hash, myself = this, urlLanguage = null;
this.cloud.initSession(
function (username) {
if (username) {
myself.source = 'cloud';
if (!myself.cloud.verified) {
new DialogBoxMorph().inform(
'Unverified account',
'Your account is still unverified.\n' +
'Please use the verification link that\n' +
'was sent to your email address when you\n' +
'signed up.\n\n' +
'If you cannot find that email, please\n' +
'check your spam folder. If you still\n' +
'cannot find it, please use the "Resend\n' +
'Verification Email..." option in the cloud\n' +
'menu.',
world,
myself.cloudIcon(null, new Color(0, 180, 0))
);
}
function initUser(username) {
sessionStorage.username = username;
if (username) {
myself.source = 'cloud';
if (!myself.cloud.verified) {
new DialogBoxMorph().inform(
'Unverified account',
'Your account is still unverified.\n' +
'Please use the verification link that\n' +
'was sent to your email address when you\n' +
'signed up.\n\n' +
'If you cannot find that email, please\n' +
'check your spam folder. If you still\n' +
'cannot find it, please use the "Resend\n' +
'Verification Email..." option in the cloud\n' +
'menu.',
world,
myself.cloudIcon(null, new Color(0, 180, 0))
);
}
}
);
}
if (!sessionStorage.username) {
// check whether login should persist across browser sessions
this.cloud.initSession(initUser);
} else {
// login only persistent during a single browser session
this.cloud.checkCredentials(initUser);
}
this.buildPanes();
world.add(this);
@ -5283,6 +5290,7 @@ IDE_Morph.prototype.initializeCloud = function () {
user.password,
user.choice,
function (username, isadmin, response) {
sessionStorage.username = username;
myself.source = 'cloud';
if (!isNil(response.days_left)) {
new DialogBoxMorph().inform(
@ -5467,9 +5475,11 @@ IDE_Morph.prototype.logout = function () {
var myself = this;
this.cloud.logout(
function () {
delete(sessionStorage.username);
myself.showMessage('disconnected.', 2);
},
function () {
delete(sessionStorage.username);
myself.showMessage('disconnected.', 2);
}
);