Commit 9e430d1c authored by Leigh Stoller's avatar Leigh Stoller

Make sure that admins cannot duplicate an email address (same email

for more then one user) as this messes up mailman. Besides, we will
eventually have to switch to email uids at some point, so they will
need to be unique anyway.
parent c1bb91ff
......@@ -2023,6 +2023,20 @@ function TBGetVersionInfo(&$major, &$minor, &$build)
return 1;
}
#
# Is email address unique?
#
function TBUniqueEmail($uid, $email)
{
$query_result =
DBQueryFatal("select usr_email from users where ".
"usr_email='$email' and uid!='$uid'");
if (mysql_num_rows($query_result))
return 0;
return 1;
}
#
# DB Interface.
#
......
......@@ -519,6 +519,9 @@ if (!isset($formfields[usr_email]) ||
elseif (! TBvalid_email($formfields[usr_email])) {
$errors["Email Address"] = TBFieldErrorString();
}
elseif (! TBUniqueEmail($target_uid, $formfields[usr_email])) {
$errors["Email Address"] = "Already in use by another user!";
}
if (!$isadmin && !$wikionly) {
# Admins can leave these fields blank, but must error check them anyway.
if (!isset($formfields[usr_addr]) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment