Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

splits saving of auth details out of CPasswordManager::PromptForAuthe…

…ntication
  • Loading branch information...
commit 870c888eabb3bb360e257395441f6b69c1742c00 1 parent 35c9f14
Jonathan Marshall authored
Showing with 23 additions and 3 deletions.
  1. +10 −2 xbmc/PasswordManager.cpp
  2. +13 −1 xbmc/PasswordManager.h
View
12 xbmc/PasswordManager.cpp
@@ -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();
@@ -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()
View
14 xbmc/PasswordManager.h
@@ -63,11 +63,23 @@ 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
*/
void Clear();

0 comments on commit 870c888

Please sign in to comment.
Something went wrong with that request. Please try again.