mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[fix] Postinstall & login
This commit is contained in:
parent
e092b9beff
commit
7eae04b1b9
1 changed files with 17 additions and 10 deletions
27
js/app.js
27
js/app.js
|
@ -93,7 +93,7 @@ app = Sammy('#main', function (sam) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
isInstalled: function() {
|
checkInstall: function(callback) {
|
||||||
domain = window.location.hostname;
|
domain = window.location.hostname;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -101,10 +101,10 @@ app = Sammy('#main', function (sam) {
|
||||||
timeout: 3000
|
timeout: 3000
|
||||||
})
|
})
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
return data.installed;
|
callback(data.installed);
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
return false;
|
callback(false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -227,10 +227,12 @@ app = Sammy('#main', function (sam) {
|
||||||
if (window.location.hostname === args.domain) {
|
if (window.location.hostname === args.domain) {
|
||||||
window.open('https://'+ args.domain +'/yunohost/admin');
|
window.open('https://'+ args.domain +'/yunohost/admin');
|
||||||
} else {
|
} else {
|
||||||
if (!c.isInstalled()) {
|
c.checkInstall(function(isInstalled) {
|
||||||
c.flash('success', y18n.t('installation_complete'));
|
if (isInstalled) {
|
||||||
c.redirect('#/login');
|
c.flash('success', y18n.t('installation_complete'));
|
||||||
}
|
c.redirect('#/login');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} else {
|
} else {
|
||||||
|
@ -367,9 +369,14 @@ app = Sammy('#main', function (sam) {
|
||||||
$('#masthead').show();
|
$('#masthead').show();
|
||||||
$('.logout-button').hide();
|
$('.logout-button').hide();
|
||||||
store.set('path-1', '#/login');
|
store.set('path-1', '#/login');
|
||||||
if (!c.isInstalled()) {
|
c.checkInstall(function(isInstalled) {
|
||||||
c.redirect('#/postinstall');
|
if (isInstalled) {
|
||||||
}
|
domain = window.location.hostname;
|
||||||
|
c.view('login', { 'domain': domain });
|
||||||
|
} else {
|
||||||
|
c.view('login');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
sam.post('#/login', function (c) {
|
sam.post('#/login', function (c) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue