|
Lines 41-58
unless ( C4::Context->preference('PatronSelfRegistration') ) {
Link Here
|
| 41 |
} |
41 |
} |
| 42 |
|
42 |
|
| 43 |
my $token = $cgi->param('token'); |
43 |
my $token = $cgi->param('token'); |
|
|
44 |
my $op = $cgi->param('op'); |
| 45 |
my $confirmed; |
| 46 |
if ( $op && $op eq 'confirmed' ) { |
| 47 |
$confirmed = 1; |
| 48 |
} |
| 44 |
my $m = Koha::Patron::Modifications->find( { verification_token => $token } ); |
49 |
my $m = Koha::Patron::Modifications->find( { verification_token => $token } ); |
| 45 |
|
50 |
|
| 46 |
my ( $template, $borrowernumber, $cookie ); |
51 |
my ( $template, $borrowernumber, $cookie ); |
| 47 |
my ( $error_type, $error_info ); |
52 |
my ( $error_type, $error_info ); |
| 48 |
|
53 |
|
|
|
54 |
my $rego_found; |
| 49 |
if ( |
55 |
if ( |
| 50 |
$m # The token exists and the email is unique if requested |
56 |
$m # The token exists and the email is unique if requested |
| 51 |
and not( |
57 |
and not(C4::Context->preference('PatronSelfRegistrationEmailMustBeUnique') |
| 52 |
C4::Context->preference('PatronSelfRegistrationEmailMustBeUnique') |
58 |
and Koha::Patrons->search( { email => $m->email } )->count ) |
| 53 |
and Koha::Patrons->search( { email => $m->email } )->count |
|
|
| 54 |
) |
59 |
) |
| 55 |
) |
60 |
{ |
|
|
61 |
$rego_found = 1; |
| 62 |
} |
| 63 |
|
| 64 |
if ( $rego_found |
| 65 |
and !$confirmed ) |
| 66 |
{ |
| 67 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
| 68 |
{ |
| 69 |
template_name => "opac-registration-confirmation.tt", |
| 70 |
type => "opac", |
| 71 |
query => $cgi, |
| 72 |
authnotrequired => C4::Context->preference("OpacPublic") ? 1 : 0, |
| 73 |
} |
| 74 |
); |
| 75 |
$template->param( "token" => $token ); |
| 76 |
} |
| 77 |
elsif ( $rego_found |
| 78 |
and $confirmed ) |
| 56 |
{ |
79 |
{ |
| 57 |
my $patron_attrs = $m->unblessed; |
80 |
my $patron_attrs = $m->unblessed; |
| 58 |
$patron_attrs->{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($patron_attrs->{categorycode})); |
81 |
$patron_attrs->{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($patron_attrs->{categorycode})); |
|
Lines 88-93
if (
Link Here
|
| 88 |
authnotrequired => C4::Context->preference("OpacPublic") ? 1 : 0, |
111 |
authnotrequired => C4::Context->preference("OpacPublic") ? 1 : 0, |
| 89 |
} |
112 |
} |
| 90 |
); |
113 |
); |
|
|
114 |
$template->param( "confirmed" => 1 ); |
| 91 |
C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences'); |
115 |
C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences'); |
| 92 |
|
116 |
|
| 93 |
$template->param( password_cleartext => $patron->plain_text_password ); |
117 |
$template->param( password_cleartext => $patron->plain_text_password ); |
| 94 |
- |
|
|