If no authToken is stored in settings but email and password are on startup the log_in route is triggered to receive a new token. This token will be used to access a protected API.
This commit is contained in:
@ -156,6 +156,12 @@ bool GenericCore::isSyncServerSetup() const {
|
||||
}
|
||||
}
|
||||
|
||||
void GenericCore::onLoginSuccessful() {
|
||||
qInfo() << "Login successful.";
|
||||
emit displayStatusMessage("Login successful.");
|
||||
emit sendGetRequest(GetCurrentBiddingRound);
|
||||
}
|
||||
|
||||
void GenericCore::onBiddingsChanged(const QList<bidding> biddings) {
|
||||
qInfo() << "onBiddingsChanged: biddings:" << biddings.count();
|
||||
// NEXT merge biddings into model
|
||||
@ -166,7 +172,7 @@ void GenericCore::onCreateOnlineAccountTriggered(const QString& mailAddress) {
|
||||
qInfo() << "Creating online account for:" << mailAddress;
|
||||
QHash<QString, QVariant> hash;
|
||||
hash.insert("email", mailAddress);
|
||||
const QByteArray jsonDoc = JsonParser::ToJsonObject(hash, "user");
|
||||
const QByteArray jsonDoc = JsonParser::toJsonDoc(hash, "user");
|
||||
emit sendPostRequest(RegisterUser, jsonDoc);
|
||||
}
|
||||
|
||||
@ -256,6 +262,7 @@ void GenericCore::applyServerConfiguration() {
|
||||
if (!urlValue.isEmpty()) {
|
||||
const QString emailValue = serverSettings.value("email").toString();
|
||||
const QString passwordValue = serverSettings.value("password").toString();
|
||||
m_serverCommunicator->setServerConfiguration(urlValue, emailValue, passwordValue);
|
||||
const QString authToken = serverSettings.value("token").toString();
|
||||
m_serverCommunicator->setServerConfiguration(urlValue, emailValue, passwordValue, authToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user