mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
fixed bug 35039 - POP: Shouldn't got an Alert when canceling login dialog
This commit is contained in:
parent
3040132f48
commit
c5cebe0547
@ -82,7 +82,7 @@ interface nsIMsgIncomingServer : nsISupports {
|
||||
attribute string password;
|
||||
|
||||
/* prompt the user for a password */
|
||||
string getPasswordWithUI(in wstring aPromptString, in wstring aPromptTitle, in nsIMsgWindow aMsgWindow);
|
||||
string getPasswordWithUI(in wstring aPromptString, in wstring aPromptTitle, in nsIMsgWindow aMsgWindow, out boolean okayValue);
|
||||
|
||||
/* forget the password in memory and in single signon database */
|
||||
void forgetPassword();
|
||||
|
@ -599,11 +599,13 @@ NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||
PRUnichar *aPromptTitle,
|
||||
nsIMsgWindow* aMsgWindow,
|
||||
PRBool *okayValue,
|
||||
char **aPassword)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aPassword);
|
||||
NS_ENSURE_ARG_POINTER(okayValue);
|
||||
|
||||
if (m_password.IsEmpty()) {
|
||||
nsCOMPtr<nsINetPrompt> dialog;
|
||||
@ -635,14 +637,13 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||
if (NS_SUCCEEDED(rv) && dialog)
|
||||
{
|
||||
nsXPIDLString uniPassword;
|
||||
PRBool okayValue = PR_TRUE;
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = dialog->PromptPassword(serverUri, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniPassword), &okayValue);
|
||||
rv = dialog->PromptPassword(serverUri, PR_FALSE, aPromptTitle, aPromptMessage, getter_Copies(uniPassword), okayValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!okayValue) // if the user pressed cancel, just return NULL;
|
||||
if (!*okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
*aPassword = nsnull;
|
||||
return rv;
|
||||
|
@ -1404,12 +1404,14 @@ NS_IMETHODIMP nsImapIncomingServer::PromptForPassword(char ** aPassword,
|
||||
PRUnichar *passwordText = nsnull;
|
||||
nsXPIDLCString hostName;
|
||||
nsXPIDLCString userName;
|
||||
PRBool okayValue;
|
||||
|
||||
GetHostName(getter_Copies(hostName));
|
||||
GetUsername(getter_Copies(userName));
|
||||
|
||||
passwordText = nsTextFormatter::smprintf(passwordTemplate, (const char *) userName, (const char *) hostName);
|
||||
nsresult rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow, aPassword);
|
||||
nsresult rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow,
|
||||
&okayValue, aPassword);
|
||||
nsTextFormatter::smprintf_free(passwordText);
|
||||
nsCRT::free(passwordTemplate);
|
||||
nsCRT::free(passwordTitle);
|
||||
|
@ -510,7 +510,7 @@ void nsPop3Protocol::SetUsername(const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsPop3Protocol::GetPassword(char ** aPassword)
|
||||
nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
|
||||
@ -571,7 +571,7 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword)
|
||||
mStringService->GetStringByID(POP3_ENTER_PASSWORD_PROMPT_TITLE, &passwordTitle);
|
||||
|
||||
rv = server->GetPasswordWithUI(passwordPromptString, passwordTitle,
|
||||
aMsgWindow, aPassword);
|
||||
aMsgWindow, okayValue, aPassword);
|
||||
nsCRT::free(passwordTitle);
|
||||
nsTextFormatter::smprintf_free(passwordPromptString);
|
||||
|
||||
@ -970,9 +970,18 @@ PRInt32 nsPop3Protocol::SendPassword()
|
||||
if (!m_pop3ConData->command_succeeded)
|
||||
return(Error(POP3_USERNAME_FAILURE));
|
||||
nsXPIDLCString password;
|
||||
nsresult rv = GetPassword(getter_Copies(password));
|
||||
if (NS_FAILED(rv) || !password || !(* (const char *) password))
|
||||
PRBool okayValue = PR_TRUE;
|
||||
nsresult rv = GetPassword(getter_Copies(password), &okayValue);
|
||||
if (NS_SUCCEEDED(rv) && !okayValue)
|
||||
{
|
||||
// user has canceled the password prompt
|
||||
m_pop3ConData->next_state = POP3_ERROR_DONE;
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
else if (NS_FAILED(rv) || !password || !(* (const char *) password))
|
||||
{
|
||||
return Error(POP3_PASSWORD_UNDEFINED);
|
||||
}
|
||||
|
||||
nsCAutoString cmd;
|
||||
|
||||
@ -2181,11 +2190,7 @@ nsPop3Protocol::TopResponse(nsIInputStream* inputStream, PRUint32 length)
|
||||
Note that the progress bar will not be accurate in this case.
|
||||
Oops. #### */
|
||||
PRBool prefBool = PR_FALSE;
|
||||
|
||||
#if 0
|
||||
m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
|
||||
m_pop3ConData->truncating_cur_msg = PR_FALSE;
|
||||
#endif
|
||||
|
||||
PRUnichar * statusTemplate = nsnull;
|
||||
mStringService->GetStringByID(POP3_SERVER_DOES_NOT_SUPPORT_THE_TOP_COMMAND, &statusTemplate);
|
||||
@ -2420,7 +2425,8 @@ nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aIn
|
||||
prompt the user for a password; just tell him we don't
|
||||
know whether he has new mail. */
|
||||
nsXPIDLCString password;
|
||||
GetPassword(getter_Copies(password));
|
||||
PRBool okayValue;
|
||||
GetPassword(getter_Copies(password), &okayValue);
|
||||
const char * pwd = (const char *) password;
|
||||
if ((m_pop3ConData->only_check_for_new_mail /* ||
|
||||
MSG_Biff_Master_NikiCallingGetNewMail() */) &&
|
||||
|
@ -255,7 +255,7 @@ public:
|
||||
const char* GetUsername() { return m_username.GetBuffer(); };
|
||||
void SetUsername(const char* name);
|
||||
|
||||
nsresult GetPassword(char ** aPassword);
|
||||
nsresult GetPassword(char ** aPassword, PRBool *okayValue);
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user