aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-05-27 16:49:15 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-05-27 16:49:15 +0900
commita2c08f646bf2d6fe0ce385940b5c1bb7b430d5fb (patch)
tree28a6876b08ce27757ffe3bddb053916768ce6426
parentd5df4568d34487aea519ae97dd1666927dcfb62b (diff)
downloadlibquotient-a2c08f646bf2d6fe0ce385940b5c1bb7b430d5fb.tar.gz
libquotient-a2c08f646bf2d6fe0ce385940b5c1bb7b430d5fb.zip
Don't assign the token twice
In a case when authentication doesn't even happen, PasswordLogin job won't run. The better place to assign (and log) the token is in Connection::connectWithToken(), therefore.
-rw-r--r--connection.cpp2
-rw-r--r--jobs/passwordlogin.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/connection.cpp b/connection.cpp
index a219f1da..69121930 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -79,6 +79,8 @@ void Connection::connectWithToken(QString userId, QString token)
d->isConnected = true;
d->userId = userId;
d->data->setToken(token);
+ qDebug() << "Connected with token:";
+ qDebug() << token;
emit connected();
}
diff --git a/jobs/passwordlogin.cpp b/jobs/passwordlogin.cpp
index d989815f..6cf45b26 100644
--- a/jobs/passwordlogin.cpp
+++ b/jobs/passwordlogin.cpp
@@ -88,9 +88,7 @@ void PasswordLogin::parseJson(const QJsonDocument& data)
fail( BaseJob::UserDefinedError, "Unexpected data" );
}
d->returned_token = json.value("access_token").toString();
- qDebug() << d->returned_token;
d->returned_server = json.value("home_server").toString();
d->returned_id = json.value("user_id").toString();
- connection()->setToken(d->returned_token);
emitResult();
}