How to stop execution until a condition evaluated, this code always return undefined:
function test() {
    var allGood;
    account.isUserAuthenticated().then(function(data) {
        if (data) {
            allGood = false;
        } else {
            allGood =  true;
        }
    });
    return allGood;
}
 
     
    