Skip to content
Snippets Groups Projects
Commit c7435255 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #129 from greezybacon/issue/validate-user-email-update


Forbid update of email address to one of another user

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 5a8b254d 5fbc662b
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,18 @@ class DynamicFormsAjaxAPI extends AjaxController {
$valid &= $cd->isValid();
}
if ($valid) {
foreach ($custom_data as $cd)
foreach ($cd->getFields() as $f)
if ($f->get('name') == 'email')
$email = $f;
$u = User::lookup(array('emails__address'=>$email->getClean()));
if ($u && $u->id != $user_id) {
$valid = false;
$email->addError('Email is assigned to another user');
}
}
if (!$valid) {
include(STAFFINC_DIR . 'templates/user-info.tmpl.php');
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment