Revision 8211
Added by Jing Tao over 11 years ago
src/perl/ldapweb.cgi | ||
---|---|---|
1024 | 1024 |
|
1025 | 1025 |
|
1026 | 1026 |
####################send the verification email to the user |
1027 |
my $link = $contextUrl. '/cgi-bin/ldapweb.cgi?cfg=' . $skinName . '&' . 'stage=' . $emailVerification . '&' . 'dn=' . $dn . '&' . 'hash=' . $randomStr . '&' . $ldapConfig->{$org}{'org'} . '&uid=' . $query->param('uid');
|
|
1027 |
my $link = $contextUrl. '/cgi-bin/ldapweb.cgi?cfg=' . $skinName . '&' . 'stage=' . $emailVerification . '&' . 'dn=' . $dn . '&' . 'hash=' . $randomStr . '&o=' . $org . '&uid=' . $query->param('uid'); #even though we use o=something. The emailVerification will figure the real o= or ou=something.
|
|
1028 | 1028 |
|
1029 | 1029 |
my $mailhost = $properties->getProperty('email.mailhost'); |
1030 | 1030 |
my $sender; |
... | ... | |
1211 | 1211 |
my $dn = $query->param('dn'); |
1212 | 1212 |
my $hash = $query->param('hash'); |
1213 | 1213 |
my $org = $query->param('o'); |
1214 |
my $ou = $query->param('ou'); |
|
1215 | 1214 |
my $uid = $query->param('uid'); |
1216 | 1215 |
|
1217 |
my $orgAttributeName; |
|
1218 | 1216 |
my $ldapUsername; |
1219 | 1217 |
my $ldapPassword; |
1220 |
my $ldaporg; |
|
1221 |
my $orgAuthBase; |
|
1222 |
if($org) { |
|
1223 |
$ldapUsername = $ldapConfig->{$org}{'user'}; |
|
1224 |
$ldapPassword = $ldapConfig->{$org}{'password'}; |
|
1225 |
$orgAttributeName = 'o'; |
|
1226 |
$ldaporg = $org; |
|
1227 |
$orgAuthBase = $ldapConfig->{$org}{'base'}; |
|
1228 |
} else { |
|
1229 |
$ldapUsername = $ldapConfig->{$ou}{'user'}; |
|
1230 |
$ldapPassword = $ldapConfig->{$ou}{'password'}; |
|
1231 |
$orgAttributeName = 'ou'; |
|
1232 |
$ldaporg = $ou; |
|
1233 |
$orgAuthBase = $ldapConfig->{$org}{'base'}; |
|
1234 |
} |
|
1218 |
#my $orgAuthBase; |
|
1219 |
|
|
1220 |
$ldapUsername = $ldapConfig->{$org}{'user'}; |
|
1221 |
$ldapPassword = $ldapConfig->{$org}{'password'}; |
|
1222 |
#$orgAuthBase = $ldapConfig->{$org}{'base'}; |
|
1223 |
|
|
1235 | 1224 |
debug("LDAP connection to $ldapurl..."); |
1236 | 1225 |
|
1237 | 1226 |
|
... | ... | |
1241 | 1230 |
if ($ldap) { |
1242 | 1231 |
$ldap->start_tls( verify => 'none'); |
1243 | 1232 |
$ldap->bind( version => 3, dn => $ldapUsername, password => $ldapPassword ); |
1244 |
my $mesg = $ldap->search(base => $dn, scope => 'base', filter => '(objectClass=*)'); |
|
1233 |
my $mesg = $ldap->search(base => $dn, scope => 'base', filter => '(objectClass=*)'); #This dn is with the dc=tmp. So it will find out the temporary account registered in registration step.
|
|
1245 | 1234 |
my $max = $mesg->count; |
1246 | 1235 |
debug("the count is " . $max); |
1247 | 1236 |
if($max < 1) { |
... | ... | |
1261 | 1250 |
#$$additions[$#$additions + 1] = $entry->get_value( $attr ); |
1262 | 1251 |
#} |
1263 | 1252 |
#} |
1264 |
#my $tmp=0; |
|
1265 |
#my $allParams=""; |
|
1253 |
|
|
1254 |
|
|
1255 |
my $orgDn = $ldapConfig->{$org}{'dn'}; #the DN for the organization. |
|
1266 | 1256 |
$mesg = $ldap->moddn( |
1267 | 1257 |
dn => $dn, |
1268 | 1258 |
deleteoldrdn => 1, |
1269 | 1259 |
newrdn => "uid=" . $uid, |
1270 |
newsuperior => $orgAttributeName . "=" . $ldaporg . "," . $orgAuthBase);
|
|
1260 |
newsuperior => $orgDn);
|
|
1271 | 1261 |
$ldap->unbind; # take down session |
1272 | 1262 |
if($mesg->code()) { |
1273 | 1263 |
fullTemplate( ['registerFailed'], {errorMessage => "Cannot move the account from the inactive area to the ative area since " . $mesg->error()}); |
Also available in: Unified diff
Fixed a bug that email verificaton doesn't work well on "ou=Account".