Bug 24663: Handle special cases for recovery password and selfreg

The password recovery and self-registration features need to be
accessible at the OPAC even if not public.

Test plan:
Self register a new account, then ask for a new password with OpacPublic
turned off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-02-17 16:44:37 +01:00
parent 8f40973f0f
commit 5efc27ea53
1 changed files with 18 additions and 4 deletions

View File

@ -171,7 +171,9 @@ sub get_template_and_user {
$in->{'query'},
$in->{'authnotrequired'},
$in->{'flagsrequired'},
$in->{'type'}
$in->{'type'},
undef,
$in->{template_name},
);
}
@ -782,9 +784,21 @@ sub checkauth {
my $flagsrequired = shift;
my $type = shift;
my $emailaddress = shift;
my $template_name = shift;
$type = 'opac' unless $type;
$authnotrequired = 0 unless C4::Context->preference("OpacPublic");
unless ( C4::Context->preference("OpacPublic") ) {
my @allowed_scripts_for_private_opac = qw(
opac-memberentry.tt
opac-registration-email-sent.tt
opac-registration-confirmation.tt
opac-memberentry-update-submitted.tt
opac-password-recovery.tt
);
$authnotrequired = 0 unless grep { $_ eq $template_name }
@allowed_scripts_for_private_opac;
}
my $dbh = C4::Context->dbh;
my $timeout = _timeout_syspref();
@ -1249,8 +1263,8 @@ sub checkauth {
$LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi;
$LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg;
my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
my $template = C4::Templates::gettemplate( $template_name, $type, $query );
my $auth_template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
my $template = C4::Templates::gettemplate( $auth_template_name, $type, $query );
$template->param(
login => 1,
INPUTS => \@inputs,