Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
splits saving of auth details out of CPasswordManager::PromptForAuthe…
Browse files Browse the repository at this point in the history
…ntication
  • Loading branch information
Jonathan Marshall committed Jul 7, 2012
1 parent 35c9f14 commit 870c888
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
12 changes: 10 additions & 2 deletions xbmc/PasswordManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,21 @@ bool CPasswordManager::PromptToAuthenticateURL(CURL &url)
url.SetUserName(username);

// save the information for later
SaveAuthenticatedURL(url, saveDetails);
return true;
}

void CPasswordManager::SaveAuthenticatedURL(const CURL &url, bool saveToProfile)
{
CSingleLock lock(m_critSection);

CStdString path = GetLookupPath(url);
CStdString authenticatedPath = url.Get();

if (!m_loaded)
Load();

if (saveDetails)
if (saveToProfile)
{ // write to some random XML file...
m_permanentCache[path] = authenticatedPath;
Save();
Expand All @@ -93,7 +102,6 @@ bool CPasswordManager::PromptToAuthenticateURL(CURL &url)
// save for both this path and more generally the server as a whole.
m_temporaryCache[path] = authenticatedPath;
m_temporaryCache[GetServerLookup(path)] = authenticatedPath;
return true;
}

void CPasswordManager::Clear()
Expand Down
14 changes: 13 additions & 1 deletion xbmc/PasswordManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,22 @@ class CPasswordManager
\param url the URL to authenticate.
\return true if the user entered details, false if the user cancelled the dialog.
\sa CURL
\sa CURL, SaveAuthenticatedURL
*/
bool PromptToAuthenticateURL(CURL &url);

/*!
\brief Save an authenticated URL.
This routine stores an authenticated URL in the temporary cache, and optionally
saves these details into the users profile.
\param url the URL to authenticate.
\param saveToProfile whether to save in the users profile, defaults to true.
\sa CURL, PromptToAuthenticateURL
*/
void SaveAuthenticatedURL(const CURL &url, bool saveToProfile = true);

/*!
\brief Clear any previously cached passwords
*/
Expand Down

0 comments on commit 870c888

Please sign in to comment.