mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed re-login after wrong passwd. Patch from Electron
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7669 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f7f1da01b5
commit
04b3b432e8
@ -96,6 +96,11 @@ bool RsAccountsDetail::lockPreferredAccount()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RsAccountsDetail::unlockPreferredAccount()
|
||||
{
|
||||
mAccountsLocked = false;
|
||||
}
|
||||
|
||||
|
||||
bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString)
|
||||
@ -1196,45 +1201,6 @@ bool RsInit::LoadPassword(const std::string& id, const std::string& inPwd)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
std::string RsAccountsDetail::getHomePath()
|
||||
{
|
||||
std::string home;
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#ifndef WINDOWS_SYS /* UNIX */
|
||||
|
||||
home = getenv("HOME");
|
||||
|
||||
#else /* Windows */
|
||||
|
||||
char *h2 = getenv("HOMEDRIVE");
|
||||
char *h3 = getenv("HOMEPATH");
|
||||
|
||||
if(!h2)
|
||||
{
|
||||
// Might be Win95/98
|
||||
// generate default.
|
||||
home = "C:\\Retro";
|
||||
}
|
||||
else
|
||||
{
|
||||
home = h2;
|
||||
home += h3;
|
||||
home += "\\Desktop";
|
||||
}
|
||||
|
||||
std::cerr << "fltkserver::getHomePath() -> " << home << std::endl;
|
||||
|
||||
// convert to desired format.
|
||||
home = RsDirUtil::convertPathToUnix(home);
|
||||
#endif
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
return home;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
* PUBLIC INTERFACE FUNCTIONS
|
||||
********************************************************************************/
|
||||
|
@ -70,6 +70,7 @@ class RsAccountsDetail
|
||||
bool setupBaseDirectory(std::string alt_basedir);
|
||||
bool loadAccounts();
|
||||
bool lockPreferredAccount();
|
||||
void unlockPreferredAccount();
|
||||
|
||||
// Paths.
|
||||
std::string PathDataDirectory();
|
||||
@ -127,8 +128,6 @@ class RsAccountsDetail
|
||||
|
||||
bool defaultBaseDirectory();
|
||||
|
||||
std::string getHomePath() ;
|
||||
|
||||
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
|
||||
int& failing_accounts,
|
||||
std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
||||
|
@ -625,33 +625,39 @@ int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath
|
||||
return 3; // invalid PreferredAccount.
|
||||
}
|
||||
|
||||
int retVal = 0;
|
||||
|
||||
// Logic that used to be external to RsInit...
|
||||
RsPeerId accountId;
|
||||
if (!rsAccounts->getPreferredAccountId(accountId))
|
||||
{
|
||||
return 3; // invalid PreferredAccount;
|
||||
retVal = 3; // invalid PreferredAccount;
|
||||
}
|
||||
|
||||
RsPgpId pgpId;
|
||||
std::string pgpName, pgpEmail, location;
|
||||
|
||||
if (!rsAccounts->getAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
|
||||
return 3; // invalid PreferredAccount;
|
||||
if (retVal == 0 && !rsAccounts->getAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
|
||||
retVal = 3; // invalid PreferredAccount;
|
||||
|
||||
if (!rsAccounts->SelectPGPAccount(pgpId))
|
||||
return 3; // PGP Error.
|
||||
if (retVal == 0 && !rsAccounts->SelectPGPAccount(pgpId))
|
||||
retVal = 3; // PGP Error.
|
||||
|
||||
int retVal = LockConfigDirectory(rsAccounts->PathAccountDirectory(), lockFilePath);
|
||||
if(retVal != 0)
|
||||
return retVal;
|
||||
if(retVal == 0)
|
||||
retVal = LockConfigDirectory(rsAccounts->PathAccountDirectory(), lockFilePath);
|
||||
|
||||
retVal = LoadCertificates(autoLoginNT);
|
||||
if(retVal != 1) {
|
||||
if(retVal == 0 && LoadCertificates(autoLoginNT) != 1)
|
||||
{
|
||||
UnlockConfigDirectory();
|
||||
return 3;
|
||||
retVal = 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if(retVal != 0)
|
||||
{
|
||||
rsAccounts->unlockPreferredAccount();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user