Commit cd2b08e6 authored by Shashwat Jolly's avatar Shashwat Jolly
Browse files

Change login error messages for faulty URLs

parent 528beb74
......@@ -223,6 +223,7 @@ bool EteSyncResource::handleError()
bool EteSyncResource::credentialsRequired()
{
if (mCredentialsRequired) {
qCDebug(ETESYNC_LOG) << "Credentials required";
showErrorDialog(i18n("Your EteSync credentials were changed. Please click OK to re-enter your credentials."), i18n(CharPtr(etesync_get_error_message()).get()), i18n("Credentials Changed"));
configure(winIdForDialogs());
setOnline(false);
......
......@@ -89,7 +89,7 @@ private:
std::vector<BaseHandler::Ptr> mHandlers;
std::map<QString, EteSyncJournalPtr> mJournalsCache;
QDateTime mJournalsCacheUpdateTime;
bool mCredentialsRequired;
bool mCredentialsRequired = false;
ContactHandler::Ptr mContactHandler;
CalendarHandler::Ptr mCalendarHandler;
......
......@@ -101,8 +101,13 @@ bool LoginPage::validatePage()
const bool loginResult = static_cast<SetupWizard *>(wizard())->mClientState->initToken(serverUrl, username, password);
if (!loginResult) {
auto err = etesync_get_error_code();
qCDebug(ETESYNC_LOG) << "loginResult error" << err;
if (err == EteSyncErrorCode::ETESYNC_ERROR_CODE_UNAUTHORIZED || err == EteSyncErrorCode::ETESYNC_ERROR_CODE_HTTP) {
mLoginLabel->setText(i18n("Incorrect login credentials. Please try again."));
} else if (err == EteSyncErrorCode::ETESYNC_ERROR_CODE_ENCODING) {
mLoginLabel->setText(i18n("Please ensure that the server URL is correct. The URL should start with http:// or https://."));
} else if (err == EteSyncErrorCode::ETESYNC_ERROR_CODE_CONNECTION) {
mLoginLabel->setText(i18n("Could not connect to the server. Please ensure that the server URL is correct."));
} else {
mLoginLabel->setText(i18n(CharPtr(etesync_get_error_message()).get()));
}
......
......@@ -67,7 +67,7 @@ private:
QCheckBox *mAdvancedSettings = nullptr;
QLineEdit *mServerUrl = nullptr;
QLabel *mLoginLabel = nullptr;
bool mIsInitialized;
bool mIsInitialized = false;
};
class EncryptionPasswordPage : public QWizardPage
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment