--- trunk/lib/App/RoomReservation/Reservation.pm 2009/06/28 20:34:40 1097 +++ trunk/lib/App/RoomReservation/Reservation.pm 2009/06/28 22:14:22 1098 @@ -1,10 +1,8 @@ package App::RoomReservation::Reservation; use Moose; -extends 'Frey'; -with 'Frey::Web'; +extends 'App::RoomReservation'; -use DBI; use lib 'lib'; use Frey::PPI; @@ -75,17 +73,22 @@ default => sub { 0 }, ); -sub dsn { 'DBI:Pg:dbname=room-reservation' } - my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; warn "# cols = ",join(',', @cols), $/; +sub token { + my ( $self ) = @_; + my $self = shift; + my $sth = $self->dbh->prepare(qq{ + select md5( id || email ) from reservation where email = ? + }); + $sth->execute( $self->email ); + $sth->fetchrow_array; +} + sub create_as_markup { my ($self) = @_; - my $dbh = DBI->connect( $self->dsn, '', '', { RaiseError => 1 } ) || die $DBI::errstr; - $dbh->do( qq{ set client_encoding='utf-8' } ) if $self->dsn =~ m{pg}i; - my @vals; my @p; @@ -106,10 +109,27 @@ warn "sql: $sql\n"; - my $sth = $dbh->prepare( $sql ); + my $sth = $self->dbh->prepare( $sql ); $sth->execute( @vals ); - $sth->rows; + return + $self->ime . ' ' . $self->prezime + . qq| we have accepted your registration!| + . qq| +
+ You have to confirm your e-mail address and registration + by clicking on link which should be in your e-mail INBOX shortly +
+ | + . qq|verify| + . ' or ' + . qq|cancel| + ; } + 1;