.');
return;
}
if (res.success && res.data && res.data.redirect) {
msgBox.className = 'cpc-status-box success';
msgBox.innerHTML = 'Login successful! Redirecting...';
window.location.href = res.data.redirect;
} else {
showError((res.data && res.data.message) ? res.data.message : 'Login failed. Please try again.');
}
})
.catch(function(err) {
console.error('[CompassCom login] Login request failed:', err);
showError('A network error occurred. Please check your connection, refresh the page and try again.');
});
});
}
});