Bug 99133: Trim entered email addresses and server names in Account Wizard.

r=bienvenu, sr=mscott
This commit is contained in:
Stefan.Borggraefe%gmx.de 2004-09-12 09:38:50 +00:00
Родитель b1bfd1ba19
Коммит 5d9078e776
3 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -95,3 +95,7 @@ function hostnameIsIllegal(hostname)
return false;
}
function trim(string)
{
return string.replace(/(^\s+)|(\s+$)/g, "");
}

Просмотреть файл

@ -69,7 +69,7 @@ function identityPageValidate()
function validateEmail()
{
var emailElement = document.getElementById("email");
var email = emailElement.value;
var email = trim(emailElement.value);
var emailArray = email.split('@');
if (gCurrentDomain) {

Просмотреть файл

@ -44,14 +44,14 @@ var gHideIncoming;
function serverPageValidate()
{
var smtpserver = document.getElementById("smtphostname");
var incomingServerName = document.getElementById("incomingServer");
var newsServerName = document.getElementById("newsServer");
var smtpServerName = trim(document.getElementById("smtphostname").value);
var incomingServerName = trim(document.getElementById("incomingServer").value);
var newsServerName = trim(document.getElementById("newsServer").value);
if ((gOnMailServersPage &&
((hostnameIsIllegal(incomingServerName.value) && !gHideIncoming) ||
(hostnameIsIllegal(smtpserver.value)))) ||
(gOnNewsServerPage && hostnameIsIllegal(newsServerName.value))) {
((hostnameIsIllegal(incomingServerName) && !gHideIncoming) ||
(hostnameIsIllegal(smtpServerName)))) ||
(gOnNewsServerPage && hostnameIsIllegal(newsServerName))) {
var alertText = gPrefsBundle.getString("enterValidHostname");
window.alert(alertText);
return false;
@ -68,9 +68,9 @@ function serverPageValidate()
var userName = parent.getCurrentUserName(pageData);
var hostName;
if (gOnMailServersPage)
hostName = incomingServerName.value;
hostName = incomingServerName;
else if (gOnNewsServerPage)
hostName = newsServerName.value;
hostName = newsServerName;
if (parent.AccountExists(userName,hostName,serverType)) {
alertText = gPrefsBundle.getString("accountExists");
@ -85,12 +85,12 @@ function serverPageValidate()
// If we have hidden the incoming server dialogs, we don't want
// to set the server to an empty value here
if (!gHideIncoming) {
setPageData(pageData, "server", "hostname", incomingServerName.value);
setPageData(pageData, "server", "hostname", incomingServerName);
}
setPageData(pageData, "server", "smtphostname", smtpserver.value);
setPageData(pageData, "server", "smtphostname", smtpServerName);
}
else if (gOnNewsServerPage) {
setPageData(pageData, "newsserver", "hostname", newsServerName.value);
setPageData(pageData, "newsserver", "hostname", newsServerName);
}
return true;