index.cgi
changeset 9 32a383000254
parent 8 562be4ad4e6d
child 13 deb39a02243b
equal deleted inserted replaced
8:562be4ad4e6d 9:32a383000254
    36     OPT => [qw[tel]]
    36     OPT => [qw[tel]]
    37 );
    37 );
    38 
    38 
    39 my %ttconfig = (
    39 my %ttconfig = (
    40     INCLUDE_PATH => "templates",
    40     INCLUDE_PATH => "templates",
       
    41     VARIABLES => {
       
    42 	SELF => $SELF,
       
    43     },
    41 );
    44 );
    42 
    45 
    43 my $DBH = DBI->connect($DSN, undef, undef, {RaiseError=>1});
    46 my $DBH = DBI->connect($DSN, undef, undef, {RaiseError=>1});
    44 END { $DBH and $DBH->disconnect }
    47 END { $DBH and $DBH->disconnect }
    45 
    48 
    85 				. param("mail");
    88 				. param("mail");
    86 
    89 
    87 		$sent = param("mail");
    90 		$sent = param("mail");
    88 	    }
    91 	    }
    89 	}
    92 	}
    90 	$tt->process("html.access.tpl", {
    93 	$tt->process("html.invitation.tpl", {
    91 	    sent => $sent,
    94 	    sent => $sent,
    92 	    warn => %warn ? \%warn : undef,
    95 	    warn => %warn ? \%warn : undef,
    93 	    expires => $EXPIRATION,
    96 	    expires => $EXPIRATION,
    94 	    value => { mail => scalar param("mail") },
    97 	    value => { mail => scalar param("mail") },
    95 	});
    98 	});
   126 	$tt->process("mail.confirmed.tpl", {
   129 	$tt->process("mail.confirmed.tpl", {
   127 	    to => $data{mail},
   130 	    to => $data{mail},
   128 	    confirmed => $confirmed,
   131 	    confirmed => $confirmed,
   129 	}, $sendmail)
   132 	}, $sendmail)
   130 	or die $tt->error();
   133 	or die $tt->error();
   131 	close($sendmail);
   134 	close($sendmail) or die "sendmail: $!\n";
   132 
   135 
   133 	$tt->process("html.confirm.tpl", {
   136 
       
   137 	$tt->process("html.confirmed.tpl", {
   134 	    confirmed => $confirmed,
   138 	    confirmed => $confirmed,
   135 	    error => delete $data{error},
   139 	    error => delete $data{error},
   136 	    value => \%data}) or die $tt->error();
   140 	    value => \%data}) or die $tt->error();
   137 	exit 0;
   141 	exit 0;
   138     }
   142     }
   182 	    my %r = insert(%value);
   186 	    my %r = insert(%value);
   183 
   187 
   184 	    open(my $sendmail => "|$SENDMAIL")
   188 	    open(my $sendmail => "|$SENDMAIL")
   185 		or die "Can't open $SENDMAIL: $!\n";
   189 		or die "Can't open $SENDMAIL: $!\n";
   186 
   190 
   187 	    $tt->process("mail.confirm.tpl", {
   191 	    $tt->process("mail.form-ack.tpl", {
   188 		to => $value{mail},
   192 		to => $value{mail},
   189 		url => {
   193 		url => {
   190 		    yes => "$SELF/$r{uuid}.user?confirm=yes",
   194 		    yes => "$SELF/$r{uuid}.user?confirm=yes",
   191 		    no  => "$SELF/$r{uuid}.user?confirm=no",
   195 		    no  => "$SELF/$r{uuid}.user?confirm=no",
   192 		}
   196 		}
   193 	    }, $sendmail)
   197 	    }, $sendmail)
   194 	    or die $tt->error();
   198 	    or die $tt->error();
   195 
   199 
   196 	    close($sendmail);
   200 	    close($sendmail);
   197 
   201 
   198 	    $tt->process("html.form.ack.tpl", {
   202 	    $tt->process("html.form-ack.tpl", {
   199 		value => \%value,
   203 		value => \%value,
   200 		timestamp => $r{timestamp},
   204 		timestamp => $r{timestamp},
   201 		uuid => $r{uuid},
   205 		uuid => $r{uuid},
   202 	    }) or die $tt->error();
   206 	    }) or die $tt->error();
   203 	    exit 0;
   207 	    exit 0;