View | Details | Raw Unified | Return to bug 17494
Collapse All | Expand All

(-)a/Koha/Exceptions/Patron/Modification.pm (+12 lines)
Line 0 Link Here
1
package Koha::Exceptions::Patron::Modification;
2
3
use Modern::Perl;
4
5
use Exception::Class (
6
    'Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken' => {
7
        isa => 'Koha::Exceptions::Object',
8
        description => "The verification token given already exists",
9
    },
10
);
11
12
1;
(-)a/Koha/Patron/Modification.pm (+19 lines)
Lines 23-28 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
use Koha::Patron::Modifications;
27
use Koha::Exceptions::Patron::Modification;
28
26
use base qw(Koha::Object);
29
use base qw(Koha::Object);
27
30
28
=head1 NAME
31
=head1 NAME
Lines 33-38 Koha::Patron::Modification - Class represents a request to modify or create a pa Link Here
33
36
34
=cut
37
=cut
35
38
39
=head2 store
40
41
=cut
42
43
sub store {
44
    my ($self) = @_;
45
46
    if ( $self->verification_token ) {
47
        if ( Koha::Patron::Modifications->search( { verification_token => $self->verification_token } )->count() ) {
48
            Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken->throw;
49
        }
50
    }
51
52
    return $self->SUPER::store();
53
}
54
36
=head2 approve
55
=head2 approve
37
56
38
$m->approve();
57
$m->approve();
(-)a/opac/opac-memberentry.pl (-1 / +3 lines)
Lines 139-144 if ( $action eq 'create' ) { Link Here
139
            $template->param( 'email' => $borrower{'email'} );
139
            $template->param( 'email' => $borrower{'email'} );
140
140
141
            my $verification_token = md5_hex( time().{}.rand().{}.$$ );
141
            my $verification_token = md5_hex( time().{}.rand().{}.$$ );
142
            while ( Koha::Patron::Modifications->search( { verification_token => $verification_token } )->count() ) {
143
                $verification_token = md5_hex( time().{}.rand().{}.$$ );
144
            }
142
145
143
            $borrower{password}           = random_string("..........");
146
            $borrower{password}           = random_string("..........");
144
            $borrower{verification_token} = $verification_token;
147
            $borrower{verification_token} = $verification_token;
145
- 

Return to bug 17494