[sork] Javascript fix, and require "@" in forwarding address
John Dalbec
jpdalbec at ysu.edu
Wed Dec 10 08:55:10 PST 2003
This is a patch I'm applying locally to require that users include an "@" sign
in the forwarding address. This avoids things like "johndoeaol.com". It also
includes a javascript fix. The "document.forwards.mode.value" syntax doesn't
work in IE or Netscape 7, hence the for loop.
HTH,
John
---- Javascript fix ONLY: ----
--- /var/www/html/horde-RELENG/forwards/templates/main/javascript.inc Mon Jan
20 00:17:59 2003
+++ imp3/forwards-RELENG/templates/main/javascript.inc Wed Dec 10 11:38:34 2003
@@ -11,7 +11,24 @@
alert('You must provide a forwarding address to set');
document.forwards.where.focus();
return false;
} else {
+ for (var i=0; i < document.forwards.mode.length; i++) {
+ if (document.forwards.mode[i].checked &&
document.forwards.mode[i].value == "set") {
+ if (document.forwards.where.value == "") {
+ alert('You must provide a forwarding address to set');
+ document.forwards.where.focus();
+ return false;
+ }
+ }
+ }
return true;
}
}
----
---- Javascript fix plus "@" sign: ----
--- /var/www/html/horde-RELENG/forwards/main.php Mon Dec 1 09:06:36 2003
+++ imp3/forwards-RELENG/main.php Wed Dec 10 11:11:42 2003
@@ -57,6 +57,8 @@
$forwardwhere=Horde::getFormData('where', false);
if (!$forwardwhere) {
Horde::raiseMessage(_("You must supply an e-mail
address"),HORDE_WARNING);
+ } else if (!strstr($forwardwhere,'@')) {
+ Horde::raiseMessage(_("Your forwarding address must contain an '@'
sign followed by the domain name"),HORDE_WARNING);
} else {
if ($driver->enableForwarding($user, $realm, $oldpassword,
$forwardwhere, $metoo)) {
Horde::raiseMessage(_("Forward set!"),HORDE_SUCCESS);
--- /var/www/html/horde-RELENG/forwards/templates/main/javascript.inc Mon Jan
20 00:17:59 2003
+++ imp3/forwards-RELENG/templates/main/javascript.inc Wed Dec 10 11:38:34 2003
@@ -11,7 +11,24 @@
alert('You must provide a forwarding address to set');
document.forwards.where.focus();
return false;
+ } else if (document.forwards.where.value.indexOf("@") == -1 &&
document.forwards.mode.value == "set") {
+ alert('Your forwarding address must contain an "@" sign followed by the
domain name');
+ document.forwards.where.focus();
+ return false;
} else {
+ for (var i=0; i < document.forwards.mode.length; i++) {
+ if (document.forwards.mode[i].checked &&
document.forwards.mode[i].value == "set") {
+ if (document.forwards.where.value == "") {
+ alert('You must provide a forwarding address to set');
+ document.forwards.where.focus();
+ return false;
+ } else if (document.forwards.where.value.indexOf("@") == -1) {
+ alert('Your forwarding address must contain an "@" sign
followed by the domain name');
+ document.forwards.where.focus();
+ return false;
+ }
+ }
+ }
return true;
}
}
----
More information about the sork
mailing list