From 20f757fc37e37b788c84f3b26581071c11478c3b Mon Sep 17 00:00:00 2001 From: Kyle M Hall <kyle@bywatersolutions.com> Date: Tue, 11 Sep 2012 12:28:00 -0400 Subject: [PATCH] Bug 7067 - allow patron self registration via the opac - Followup - Add invalid token page Content-Type: text/plain; charset="utf-8" --- .../prog/en/modules/opac-registration-invalid.tt | 30 +++++++++++++++++ opac/opac-registration-verify.pl | 34 ++++++++++++------- 2 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt new file mode 100644 index 0000000..12dac1d --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt @@ -0,0 +1,30 @@ +[% INCLUDE 'doc-head-open.inc' %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog +[% INCLUDE 'doc-head-close.inc' %] +</head> +<body id="opac-main"> +[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %] + <div id="bd"> +[% INCLUDE 'masthead.inc' %] + +<div id="yui-main"> + <div class="yui-b"> + <div id="loggedin" class="yui-ge"> + <div class="yui-u first"> + <h1>Registration invalid!</h1> + + <p>There were problems processing your registration. Please contact your library for help.</p> + + </div> + </div> + </div> +</div> + +[% IF ( OpacNav ) %]<div class="yui-b"> + <div id="opacnav" class="container"> + [% INCLUDE 'navigation.inc' %] + </div> +[% END %] + +</div> +[% INCLUDE 'opac-bottom.inc' %] diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl index bf0eae4..682dacb 100755 --- a/opac/opac-registration-verify.pl +++ b/opac/opac-registration-verify.pl @@ -32,22 +32,23 @@ unless ( C4::Context->preference('PatronSelfRegistration') ) { exit; } -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "opac-registration-confirmation.tmpl", - type => "opac", - query => $cgi, - authnotrequired => 1, - } -); - -$template->param( - OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); - my $token = $cgi->param('token'); my $m = Koha::Borrower::Modifications->new( verification_token => $token ); +my ( $template, $borrowernumber, $cookie ); if ( $m->Verify() ) { + ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-registration-confirmation.tmpl", + type => "opac", + query => $cgi, + authnotrequired => 1, + } + ); + + $template->param( + OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); + my $borrower = $m->GetModifications(); my $password; @@ -68,7 +69,14 @@ if ( $m->Verify() ) { } else { - + ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-registration-invalid.tmpl", + type => "opac", + query => $cgi, + authnotrequired => 1, + } + ); } output_html_with_http_headers $cgi, $cookie, $template->output; -- 1.7.2.5