+sub action_verify
+{
+ my $cn = param ('cn');
+ $cn = shift if (@_);
+ die unless ($cn);
+
+ my $person = Person->load ($cn);
+ die unless ($person);
+
+ my ($mail) = $person->get ('mail');
+ $mail ||= '';
+
+ my $message;
+ my $password = $person->password ();
+
+ if (!$password)
+ {
+ $password = pwgen ();
+ $person->password ($password);
+ }
+
+ $message = qq(The password for the record "$cn" is "$password".);
+
+ if ($mail)
+ {
+ action_verify_send_mail ($person);
+ $message .= qq( A request for verification has been sent to $mail.);
+ }
+ else
+ {
+ $message .= q( There was no e-mail address, thus no verification request could be sent.);
+ }
+
+ print qq(\t\t<div class="message">$message</div>\n);
+
+ action_detail ($cn);
+}
+
+sub action_verify_send_mail
+{
+ my $person = shift;
+ my $owner = Person->load ($UserCN);
+ my $smh;
+
+ my $max_width = 0;
+ for (keys %FieldNames)
+ {
+ $max_width = length $FieldNames{$_} if ($max_width < length $FieldNames{$_});
+ }
+ $max_width++;
+
+ my $person_name = $person->name ();
+ my ($person_mail) = $person->get ('mail');
+ my $person_gn = $person->firstname ();
+ my $password = $person->password ();
+
+ my $owner_name = $owner->name ();
+ my ($owner_mail) = $owner->get ('mail');
+ $owner_mail ||= $ENV{'SERVER_ADMIN'};
+
+ my $host = $ENV{'HTTP_HOST'};
+ my $url = 'http://' . $host . $MySelf;
+
+ open ($smh, '| /usr/sbin/sendmail -t') or die ("open pipe to sendmail: $!");
+ print $smh <<EOM;
+To: $person_name <$person_mail>
+From: $owner_name <$owner_mail>
+Subject: Please verify our entry in my address book
+
+Hello $person_gn,
+
+the following is your entry in my address book:
+EOM
+ for (@MultiFields)
+ {
+ my $field = $_;
+ my $print = defined ($FieldNames{$field}) ? $FieldNames{$field} : $field;
+ my @values = $person->get ($field);
+
+ for (@values)
+ {
+ printf $smh ('%'.$max_width."s: %-s\n", $print, $_);
+ }
+ }
+ print $smh <<EOM;
+
+If this entry is outdated or incomplete, please take a minute and correct it.
+ Address: $url
+ Username: $person_name
+ Password: $password
+
+Thank you very much :) Regards,
+$owner_name
+EOM
+ close ($smh);
+}
+