Fix logout when disabling internet

This commit is contained in:
auria.mg 2018-11-23 18:52:17 -05:00
parent 3ff0724cb4
commit 9d51713300

View File

@ -152,9 +152,12 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet is being activated, enable immediately. If it's being disabled,
// we'll disable later after logout.
if (internet->getState())
UserConfigParams::m_internet_status = RequestManager::IPERM_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
@ -182,6 +185,10 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
// Deactivate internet after 'requestSignOut' so that the sign out request is allowed
if (!internet->getState())
UserConfigParams::m_internet_status = RequestManager::IPERM_NOT_ALLOWED;
}
else if (name=="enable-hw-report")
{