refactor: use proper qt widgets patterns for auth
This commit is contained in:
+11
-1
@@ -31,7 +31,7 @@ AuthManager::AuthManager(QObject *parent)
|
||||
});
|
||||
}
|
||||
|
||||
void AuthManager::init()
|
||||
void AuthManager::tryRestoreSession()
|
||||
{
|
||||
QString storageSessionToken = m_settings->value(key).toString();
|
||||
if (storageSessionToken.isEmpty())
|
||||
@@ -90,6 +90,15 @@ void AuthManager::setIsSignedIn(bool newValue)
|
||||
|
||||
m_isSignedIn = newValue;
|
||||
emit isSignedInChanged();
|
||||
|
||||
if (m_isSignedIn)
|
||||
{
|
||||
emit signedIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
emit signedOut();
|
||||
}
|
||||
}
|
||||
|
||||
bool AuthManager::isSignedIn() const
|
||||
@@ -162,6 +171,7 @@ void AuthManager::signIn(const QString &code)
|
||||
if (jsonDoc.isNull())
|
||||
{
|
||||
qWarning() << "Failed to create a JSON doc.";
|
||||
emit errorOccurred("Unable to verify code");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user