Commit 8417a14d authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #2850 Creating several templates with same login placeholder won't work

parent 4e6b1b5a
......@@ -1236,15 +1236,6 @@ class user extends plugin
$message[]= msgPool::permMove();
}
/* UID already used? */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(uid=$this->uid)", array("uid"));
$ldap->fetch();
if ($ldap->count() != 0 && $this->dn == 'new'){
$message[]= msgPool::duplicated(_("Login"));
}
/* In template mode, the uid and givenName are autogenerated... */
if ($this->sn == ""){
$message[]= msgPool::required(_("Name"));
......@@ -1256,6 +1247,15 @@ class user extends plugin
}
if (!$this->is_template){
/* UID already used? */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(uid=$this->uid)", array("uid"));
$ldap->fetch();
if ($ldap->count() != 0 && $this->dn == 'new'){
$message[]= msgPool::duplicated(_("Login"));
}
if ($this->givenName == ""){
$message[]= msgPool::required(_("Given name"));
}
......
Supports Markdown
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