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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-3 / +5 lines)
Lines 1234-1243 Link Here
1234
    [% UNLESS patron %]
1234
    [% UNLESS patron %]
1235
        var PWD_STRONG_MSG = _("Password must contain at least %s characters, including UPPERCASE, lowercase and numbers");
1235
        var PWD_STRONG_MSG = _("Password must contain at least %s characters, including UPPERCASE, lowercase and numbers");
1236
        var PWD_WEAK_MSG = _("Password must contain at least %s characters");
1236
        var PWD_WEAK_MSG = _("Password must contain at least %s characters");
1237
        var default_password_length = [% defaultCategory.effective_min_password_length | html %];
1238
        var default_strong_password = [% defaultCategory.effective_require_strong_password | html %];
1237
        $(document).ready(function() {
1239
        $(document).ready(function() {
1238
            var setPwdMessage = function() {
1240
            var setPwdMessage = function() {
1239
                var require_strong = $('select#borrower_categorycode option:selected').data('pwdStrong');
1241
                var require_strong = $('select#borrower_categorycode option:selected').data('pwdStrong')||default_strong_password;
1240
                var min_lenght = $('select#borrower_categorycode option:selected').data('pwdLength');
1242
                var min_lenght = $('select#borrower_categorycode option:selected').data('pwdLength')||default_password_length;
1241
                $('#password_alert').html((require_strong?PWD_STRONG_MSG:PWD_WEAK_MSG).format(min_lenght));
1243
                $('#password_alert').html((require_strong?PWD_STRONG_MSG:PWD_WEAK_MSG).format(min_lenght));
1242
            };
1244
            };
1243
            setPwdMessage();
1245
            setPwdMessage();
Lines 1246-1251 Link Here
1246
    [% END %]
1248
    [% END %]
1247
    //]]>
1249
    //]]>
1248
    </script>
1250
    </script>
1249
    [% PROCESS 'password_check.inc' new_password => 'borrower_password', category_selector => '#borrower_categorycode', RequireStrongPassword => patron.category.effective_require_strong_password, minPasswordLength => patron.category.effective_min_password_length %]
1251
    [% PROCESS 'password_check.inc' new_password => 'borrower_password', category_selector => '#borrower_categorycode', RequireStrongPassword => patron ? patron.category.effective_require_strong_password : defaultCategory.effective_require_strong_password, minPasswordLength => patron ? patron.category.effective_min_password_length : defaultCategory.effective_min_password_length %]
1250
1252
1251
[% END %]
1253
[% END %]
(-)a/opac/opac-memberentry.pl (-2 / +4 lines)
Lines 93-104 if ( defined $min ) { Link Here
93
     );
93
     );
94
 }
94
 }
95
95
96
my $defaultCategory = Koha::Patron::Categories->find(C4::Context->preference('PatronSelfRegistrationDefaultCategory'));
97
96
$template->param(
98
$template->param(
97
    action            => $action,
99
    action            => $action,
98
    hidden            => GetHiddenFields( $mandatory, $action ),
100
    hidden            => GetHiddenFields( $mandatory, $action ),
99
    mandatory         => $mandatory,
101
    mandatory         => $mandatory,
100
    libraries         => \@libraries,
102
    libraries         => \@libraries,
101
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
103
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
104
    defaultCategory  => $defaultCategory,
102
);
105
);
103
106
104
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
107
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
Lines 476-482 sub CheckForInvalidFields { Link Here
476
        push( @invalidFields, "password_match" );
479
        push( @invalidFields, "password_match" );
477
    }
480
    }
478
    if ( $borrower->{'password'} ) {
481
    if ( $borrower->{'password'} ) {
479
        my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $borrower->{password}, Koha::Patron::Categories->find($borrower->{categorycode}) );
482
        my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $borrower->{password}, Koha::Patron::Categories->find($borrower->{categorycode}||C4::Context->preference('PatronSelfRegistrationDefaultCategory')) );
480
          unless ( $is_valid ) {
483
          unless ( $is_valid ) {
481
              push @invalidFields, 'password_too_short' if $error eq 'too_short';
484
              push @invalidFields, 'password_too_short' if $error eq 'too_short';
482
              push @invalidFields, 'password_too_weak' if $error eq 'too_weak';
485
              push @invalidFields, 'password_too_weak' if $error eq 'too_weak';
483
- 

Return to bug 27148