Skip to content

Commit

Permalink
Merge pull request #116 from leprechau/checkEmpty
Browse files Browse the repository at this point in the history
check username and password before setting authentication
  • Loading branch information
sieren committed May 22, 2016
2 parents 2604b74 + e8606b9 commit ec2fde6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/syncconnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ SyncConnector::SyncConnector(QUrl url) :
void SyncConnector::setURL(QUrl url, std::string username, std::string password,
ConnectionStateCallback setText)
{
mAuthentication = std::make_pair(username, password);
url.setUserName(mAuthentication.first.c_str());
url.setPassword(mAuthentication.second.c_str());
if (username.empty() == false && password.empty() == false) {
mAuthentication = std::make_pair(username, password);
url.setUserName(mAuthentication.first.c_str());
url.setPassword(mAuthentication.second.c_str());
}
mCurrentUrl = url;
mConnectionStateCallback = setText;
testUrlAvailability();
Expand Down

0 comments on commit ec2fde6

Please sign in to comment.