X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2FfrmNewAccount.cpp;h=bff53e14390aa173dd5ddf07734ff3af5a13e1d8;hb=3b6b6a7c6b49dd7adda12d7b469a0da356f2a999;hp=fa8d6b3f87b79af12720e906715a7bd01ac33546;hpb=85d09d9a844ff551167f6a386f98845076d98ec6;p=xestiaab%2F.git diff --git a/source/frmNewAccount.cpp b/source/frmNewAccount.cpp index fa8d6b3..bff53e1 100644 --- a/source/frmNewAccount.cpp +++ b/source/frmNewAccount.cpp @@ -24,6 +24,7 @@ #include "carddav/carddav.h" #include "common/dirs.h" +#include "common/svrblist.h" #include "frmInvalidSSLCertificate.h" frmNewAccount::frmNewAccount( wxWindow* parent ) @@ -127,6 +128,20 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } + // Check if server address matches against the blacklist. + // Bring up warning message if it does. + + if (CheckBlacklist(txtServerAddress->GetValue())){ + + int MessageBoxResult = wxMessageBox(_("The server with the address given does not support the CardDAV protocol properly and shouldn't be used.\n\nData loss is very likely.\n\nDo you still want to continue using this server?"), _("Server warning"), wxYES_NO, this); + + if (MessageBoxResult == wxNO){ + PageSeek--; + return; + } + + } + btnNext->Disable(); bool ServerResult = FALSE; @@ -182,8 +197,49 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) // SSL certificate message. // Setup the data to be sent in the wxPostEvent command. - + int SSLResult; + +#if defined(__APPLE__) + + SSLResult = DisplayTrustPanel(&CardDAVConn); + + if (SSLResult != NSOKButton){ + + lblServerConnResult->SetLabel(_("Failed")); + lblServerResponse->SetLabel(_("Not applicable")); + lblServerSSLResult->SetLabel(_("Used")); + lblServerSSLValid->SetLabel(_("No")); + lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str())); + return; + + } else { + + // Evalulate the trust object. + + SecTrustResultType EvalResult = ProcessResultType(&CardDAVConn); + + switch(EvalResult){ + case kSecTrustResultProceed: + lblServerSSLValid->SetLabel(_("Verified")); + break; + case kSecTrustResultConfirm: + lblServerSSLValid->SetLabel(_("Verified (user)")); + break; + default: + lblServerSSLValid->SetLabel(_("Unable to verify")); + } + + lblServerResponse->SetLabel(_("Not applicable")); + lblServerSSLResult->SetLabel(_("Used")); + + if (EvalResult != kSecTrustResultProceed){ + return; + } + + } + +#else frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this); @@ -214,12 +270,16 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) return; } + +#endif } else { // Something else happened. Stop the process and // display an error message instead. + CURLcode sslcode = CardDAVConn.SSLVerifyTest(); + lblServerConnResult->SetLabel(_("Failed")); lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str())); return; @@ -235,8 +295,9 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) if (ServerResult == FALSE){ lblServerConnResult->SetLabel(_("Failed")); + lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage()); return; - + } else { lblServerConnResult->SetLabel(_("Connected")); @@ -253,7 +314,26 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) lblServerSSLValid->SetLabel(_("Not Applicable")); } - + +#if defined(__APPLE__) + + // Evalulate the trust object. + + SecTrustResultType EvalResult = ProcessResultType(&CardDAVConn); + + switch(EvalResult){ + case kSecTrustResultProceed: + lblServerSSLValid->SetLabel(_("Verified")); + break; + case kSecTrustResultConfirm: + lblServerSSLValid->SetLabel(_("Verified (user)")); + break; + default: + lblServerSSLValid->SetLabel(_("Unable to verify")); + } + +#else + if (CardDAVConn.SSLVerify() == TRUE && CardDAVConn.CanDoSSL() == TRUE){ lblServerSSLValid->SetLabel(_("Verified")); @@ -266,8 +346,10 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) lblServerSSLValid->SetLabel(_("Unable to verify")); - } - + } + +#endif + if (CardDAVConn.CanDoCardDAV() == TRUE){ lblCardDAVSupportResult->SetLabel(_("Supported")); @@ -275,6 +357,8 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } else { lblCardDAVSupportResult->SetLabel(_("Unsupported")); + SetErrorMessageLabel(); + return; } @@ -285,6 +369,8 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } else { lblAbleToLoginResult->SetLabel(_("No")); + SetErrorMessageLabel(); + return; } @@ -299,6 +385,8 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } else { lblServerResponse->SetLabel(_("No")); + SetErrorMessageLabel(); + return; } @@ -312,7 +400,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } else { - lblConnectionResultText->SetLabel(_("A problem has occured whilst connecting to the CardDAV server.\nPlease review the above information and change the server details if needed.\nIf there are still problems, please speak to your system administrator(s).")); + SetErrorMessageLabel(); } @@ -601,4 +689,10 @@ void frmNewAccount::SetupPointers(bool *ReloadAccountInc){ ReloadAccountConfig = ReloadAccountInc; +} + +void frmNewAccount::SetErrorMessageLabel(){ + + lblConnectionResultText->SetLabel(_("A problem has occured whilst connecting to the CardDAV server.\nPlease review the above information and change the server details if needed.\nIf there are still problems, please speak to your system administrator(s).")); + } \ No newline at end of file