[prev] [thread] [next] [lurker] [Date index for 2003/11/23]
Author: gabor
Date: 2003-11-23 16:14:51 +0200 (Sun, 23 Nov 2003)
New Revision: 5
Modified:
lib/YAPC/Organizer.pm
Log:
add more use * tests
Modified: lib/YAPC/Organizer.pm
===================================================================
--- lib/YAPC/Organizer.pm 2003-11-23 12:01:10 UTC (rev 4)
+++ lib/YAPC/Organizer.pm 2003-11-23 14:14:51 UTC (rev 5)
@@ -34,6 +34,7 @@
'login' => 'do_login',
'logout' => 'do_logout',
'send_proposal' => 'do_send_proposal',
+ 'get_validation_code' => 'get_validation_code',
);
}
@@ -94,6 +95,50 @@
return $t->output;
}
+
+sub get_validation_code {
+ my $self = shift;
+ my $q = $self->query;
+
+ my ($person) = YAPC::Person->search(email => $q->param('email'));
+ if (not $person) {
+ my $t = $self->_server_page('email_sent', "$templates_dir/email_sent.tmpl");
+ }
+
+ my $t = $self->_server_page('email_sent', "$templates_dir/email_sent.tmpl");
+ if ($person->authcode ) {
+ send_email_with_validation_code($person);
+ }
+
+
+}
+
+
+sub send_email_with_validation_code {
+ my $self = shift;
+ my $person = shift;
+ my $q = $self->query;
+
+
+ # sending e-mail
+ my $mail = HTML::Template->new(
+ filename => "$templates_dir/email/register.tmpl",
+ die_on_bad_params => 0,
+ associate => $q);
+ $mail->param("authcode" => $person->authcode);
+ my $validation_url = "http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}";
+ $validation_url .= "?run=validation&email=" . $person->email . "&authcode=" . $person->authcode;
+ $mail->param("validation_url" => $validation_url);
+ my %mail = (To => $person->email,
+ From => $YAPC::Config::email_address,
+ Subject => "YAPC::Israel::2004 registration information",
+ Message => $mail->output,
+ );
+ sendmail(%mail) or die $Mail::Sendmail::error unless $ENV{YAPCOM_NOMAIL};
+
+
+}
+
sub _server_page {
my $self = shift;
my ($page , $filename) = @_;
@@ -226,21 +271,7 @@
return $t->output;
} else {
- # sending e-mail
- my $mail = HTML::Template->new(
- filename => "$templates_dir/email/register.tmpl",
- die_on_bad_params => 0,
- associate => $q);
- $mail->param("authcode" => $person->authcode);
- my $validation_url = "http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}";
- $validation_url .= "?run=validation&email=" . $person->email . "&authcode=" . $person->authcode;
- $mail->param("validation_url" => $validation_url);
- my %mail = (To => $person->email,
- From => $YAPC::Config::email_address,
- Subject => "YAPC::Israel::2004 registration information",
- Message => $mail->output,
- );
- sendmail(%mail) or die $Mail::Sendmail::error unless $ENV{YAPCOM_NOMAIL};
+ send_email_with_validation_code($person);
# send e-mail to administrator
Generated at 17:06 on 23 Nov 2003 by mariachi 0.51