зеркало из https://github.com/mozilla/gecko-dev.git
fix for #169227. for certain redirector types, don't show hostname in the password prompt.
r/sr=bienvenu. UI changes approved by jglick.
This commit is contained in:
Родитель
095b376754
Коммит
3e564330d2
|
@ -153,13 +153,13 @@ noIdentities=You don't have any email identities yet. Create one with the Accou
|
|||
12542=Mail Server Password Required
|
||||
|
||||
## @name NS_SMTP_PASSWORD_PROMPT
|
||||
12543=Enter your password for %1$s@%2$s.
|
||||
12543=Enter your password for %1$s@%2$s:
|
||||
|
||||
## @name NS_SMTP_CONNECTING_TO_SERVER
|
||||
12545=Connecting to server...
|
||||
|
||||
## @name NS_SMTP_USERNAME_PASSWORD_PROMPT
|
||||
12546=Enter your password for %s.
|
||||
12546=Enter your password for %s:
|
||||
|
||||
## @name NS_MSG_SENDING_MESSAGE
|
||||
12550=Sending message...
|
||||
|
|
|
@ -236,16 +236,14 @@
|
|||
## @loc None
|
||||
# LOCALIZATION NOTE (Error 5046): Do not translate the word "%S" below.
|
||||
# Place the word %S in your translation where the name of the folder should appear.
|
||||
|
||||
5046=Found folder: %S
|
||||
|
||||
## @name IMAP_ENTER_PASSWORD_PROMPT
|
||||
## @loc None
|
||||
# LOCALIZATION NOTE (Error 5047): Do not translate the word "%1$s@%2$s below.
|
||||
# Place the word "%1$s@%2$s" in your translation where the email address
|
||||
# should appear
|
||||
|
||||
5047=Enter your password for %1$s@%2$s.
|
||||
# LOCALIZATION NOTE (Error 5047): Do not translate the word %S below.
|
||||
# Place the word "%S" in your translation where the email address
|
||||
# or the username should appear
|
||||
5047=Enter your password for %S:
|
||||
|
||||
## @name IMAP_SERVER_NOT_IMAP4
|
||||
## @loc None
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Jeff Tsai <jefft@netscape.com>
|
||||
* Scott MacGregor <mscott@netscape.com>
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Alecf Flett <alecf@netscape.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
|
@ -64,7 +64,6 @@
|
|||
#include "nsImapStringBundle.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
@ -235,7 +234,8 @@ nsImapIncomingServer::GetConstructedPrettyName(PRUnichar **retval)
|
|||
|
||||
}
|
||||
}
|
||||
rv = GetFormattedName(emailAddress.get(), retval);
|
||||
|
||||
rv = GetFormattedStringFromID(emailAddress.get(), IMAP_DEFAULT_ACCOUNT_NAME, retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -2415,21 +2415,44 @@ NS_IMETHODIMP nsImapIncomingServer::ForgetPassword()
|
|||
NS_IMETHODIMP nsImapIncomingServer::PromptForPassword(char ** aPassword,
|
||||
nsIMsgWindow * aMsgWindow)
|
||||
{
|
||||
nsXPIDLString passwordTemplate;
|
||||
IMAPGetStringByID(IMAP_ENTER_PASSWORD_PROMPT, getter_Copies(passwordTemplate));
|
||||
nsXPIDLString passwordTitle;
|
||||
IMAPGetStringByID(IMAP_ENTER_PASSWORD_PROMPT_TITLE, getter_Copies(passwordTitle));
|
||||
PRUnichar *passwordText = nsnull;
|
||||
nsXPIDLCString hostName;
|
||||
nsXPIDLCString userName;
|
||||
PRBool okayValue;
|
||||
|
||||
GetRealHostName(getter_Copies(hostName));
|
||||
GetRealUsername(getter_Copies(userName));
|
||||
passwordText = nsTextFormatter::smprintf(passwordTemplate, (const char *) userName, (const char *) hostName);
|
||||
nsresult rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow,
|
||||
|
||||
nsCAutoString promptValue(userName);
|
||||
|
||||
nsCAutoString prefName;
|
||||
nsresult rv = CreatePrefNameWithRedirectorType(".hide_hostname_for_password", prefName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRBool hideHostnameForPassword = PR_FALSE;
|
||||
rv = prefBranch->GetBoolPref(prefName.get(), &hideHostnameForPassword);
|
||||
if (NS_SUCCEEDED(rv) && hideHostnameForPassword) {
|
||||
// for certain redirector types, we don't want to show the
|
||||
// hostname to the user when prompting for password
|
||||
}
|
||||
else {
|
||||
nsXPIDLCString hostName;
|
||||
GetRealHostName(getter_Copies(hostName));
|
||||
promptValue.Append("@");
|
||||
promptValue.Append(hostName);
|
||||
}
|
||||
|
||||
nsXPIDLString passwordText;
|
||||
rv = GetFormattedStringFromID(NS_ConvertASCIItoUCS2(promptValue).get(), IMAP_ENTER_PASSWORD_PROMPT, getter_Copies(passwordText));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow,
|
||||
&okayValue, aPassword);
|
||||
nsTextFormatter::smprintf_free(passwordText);
|
||||
return (okayValue) ? rv : NS_MSG_PASSWORD_PROMPT_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -3463,27 +3486,28 @@ nsImapIncomingServer::GeneratePrettyNameForMigration(PRUnichar **aPrettyName)
|
|||
}
|
||||
|
||||
// Format the pretty name
|
||||
rv = GetFormattedName(constructedPrettyName.get(), aPrettyName);
|
||||
rv = GetFormattedStringFromID(constructedPrettyName.get(), IMAP_DEFAULT_ACCOUNT_NAME, aPrettyName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Take the pretty name and return a formatted account name
|
||||
nsresult
|
||||
nsImapIncomingServer::GetFormattedName(const PRUnichar *prettyName, PRUnichar **retval)
|
||||
nsImapIncomingServer::GetFormattedStringFromID(const PRUnichar *aValue, PRInt32 aID, PRUnichar **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsresult rv;
|
||||
rv = GetStringBundle();
|
||||
if (m_stringBundle)
|
||||
{
|
||||
const PRUnichar *formatStrings[] =
|
||||
{
|
||||
prettyName,
|
||||
aValue,
|
||||
};
|
||||
rv = m_stringBundle->FormatStringFromID(IMAP_DEFAULT_ACCOUNT_NAME,
|
||||
rv = m_stringBundle->FormatStringFromID(aID,
|
||||
formatStrings, 1,
|
||||
retval);
|
||||
aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -120,7 +121,7 @@ private:
|
|||
|
||||
nsresult DoomUrlIfChannelHasError(nsIImapUrl *aImapUrl, PRBool *urlDoomed);
|
||||
PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection);
|
||||
nsresult GetFormattedName(const PRUnichar *constructedPrettyName, PRUnichar **formattedPrettyName);
|
||||
nsresult GetFormattedStringFromID(const PRUnichar *aValue, PRInt32 aID, PRUnichar **aResult);
|
||||
nsresult CreatePrefNameWithRedirectorType(const char *prefSuffix, nsCAutoString &prefName);
|
||||
nsresult GetPrefForServerAttribute(const char *prefSuffix, PRBool *prefValue);
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
## @loc None
|
||||
# LOCALIZATION NOTE(4016): Do not translate the word "%1$s@%2$s" below.
|
||||
# Place the word "%1$s@%2$s" where email account name should appear (i.e. john.smith@example.org)
|
||||
4017=Enter your password for %1$s@%2$s.
|
||||
4017=Enter your password for %1$s@%2$s:
|
||||
|
||||
## @name POP3_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC
|
||||
## @loc None
|
||||
|
@ -161,7 +161,7 @@
|
|||
|
||||
## @name POP3_ENTER_PASSWORD_PROMPT_TITLE
|
||||
## @loc None
|
||||
4020=Enter your password
|
||||
4020=Enter your password:
|
||||
|
||||
## @name moveFolderToTrash
|
||||
## @loc None
|
||||
|
|
|
@ -34,8 +34,8 @@ removeExpiredArtLinkText=Click here to remove all expired articles
|
|||
cancelDisallowed=This message does not appear to be from you. You may only cancel your own posts, not those made by others.
|
||||
cancelConfirm=Are you sure you want to cancel this message?
|
||||
messageCancelled=Message cancelled.
|
||||
enterUsername=Please enter a username for news server access
|
||||
enterPassword=Please enter a password for news server access
|
||||
enterUsername=Please enter a username for news server access:
|
||||
enterPassword=Please enter a password for news server access:
|
||||
enterPasswordTitle=News Server Password Required
|
||||
okButtonText=Download
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче