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

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/members.js (+11 lines)
Lines 128-133 function check_form_borrowers(nav){ Link Here
128
			}
128
			}
129
		}
129
		}
130
	}
130
	}
131
132
	if ( document.form.password.value != document.form.password2.value ){
133
			if ( message_champ != '' ){
134
				message_champ += "\n";
135
			} else {
136
				message = "";
137
			}
138
			message_champ+= MSG_PASSWORD_MISMATCH;
139
			statut=1;
140
	}
141
131
	//patrons form to test if you checked no to the question of double
142
	//patrons form to test if you checked no to the question of double
132
 	if (statut!=1 && document.form.check_member.value > 0 ) {
143
 	if (statut!=1 && document.form.check_member.value > 0 ) {
133
		if (!(document.form_double.answernodouble.checked)){
144
		if (!(document.form_double.answernodouble.checked)){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt (-7 / +45 lines)
Lines 1-6 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Patrons &rsaquo; [% IF ( newpassword ) %]Password Updated [% ELSE %]Update Password for [% surname %], [% firstname %][% END %]</title>
2
<title>Koha &rsaquo; Patrons &rsaquo; [% IF ( newpassword ) %]Password Updated [% ELSE %]Update Password for [% surname %], [% firstname %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/JavaScript">
5
//<![CDATA[
6
    $(document).ready(function() {
7
        $("#changepasswordf").submit(function(){
8
            if($("input[name='newpassword']").val() != $("input[name='newpassword2']").val()){
9
                alert(_("Passwords do not match"));
10
                return false;
11
            } else {
12
                return true;
13
            }
14
        });
15
        $("#fillrandom").live('click', function() {
16
            $("#newpassword").after("<input type=\"text\" name=\"newpassword\" value=\"[% defaultnewpassword %]\">").remove();
17
            $("#newpassword2").after("<input type=\"text\" name=\"newpassword2\" value=\"[% defaultnewpassword %]\">").remove();
18
        });
19
        $("div.hint").eq(0).after(" <div class=\"hint\"><a href=\"#\" id=\"fillrandom\">"+_("Click to fill with a randomly generated suggestion. ")+"<strong>"+_("Passwords will be displayed as text")+"</strong>.</a></div>");
20
    });
21
//]]>
22
</script>
4
</head>
23
</head>
5
<body>
24
<body>
6
[% INCLUDE 'header.inc' %]
25
[% INCLUDE 'header.inc' %]
Lines 20-50 Link Here
20
39
21
[% ELSE %]
40
[% ELSE %]
22
41
23
<form method="post" action="/cgi-bin/koha/members/member-password.pl">
42
<form method="post" id="changepasswordf" action="/cgi-bin/koha/members/member-password.pl">
24
<input type="hidden" name="destination" value="[% destination %]" />	
43
<input type="hidden" name="destination" value="[% destination %]" />	
25
<input type="hidden" name="cardnumber" value="[% cardnumber %]" />
44
<input type="hidden" name="cardnumber" value="[% cardnumber %]" />
26
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
45
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
27
	[% IF ( errormsg ) %]
46
	[% IF ( errormsg ) %]
47
		<div class="dialog alert">
48
		<h4>The following errors have occurred:</h4>
49
		<ul>
28
		[% IF ( BADUSERID ) %]
50
		[% IF ( BADUSERID ) %]
29
		<div class="dialog alert">You have entered a User ID that already exists.  Please choose another one.</div>
51
		<li>You have entered a username that already exists.  Please choose another one.</li>
30
		[% END %]
52
		[% END %]
31
		[% IF ( SHORTPASSWORD ) %]
53
		[% IF ( SHORTPASSWORD ) %]
32
		<div class="dialog alert"><strong>The password entered is too short</strong>. Password must be at least [% minPasswordLength %] characters.</div>
54
		<li><strong>The password entered is too short</strong>. Password must be at least [% minPasswordLength %] characters.</li>
33
		[% END %]
55
		[% END %]
34
		[% IF ( NOPERMISSION ) %]
56
		[% IF ( NOPERMISSION ) %]
35
		<div class="dialog alert">You do not have permission to edit this patron's login information.</div>
57
		<li>You do not have permission to edit this patron's login information.</li>
36
		[% END %]
58
		[% END %]
59
		[% IF ( NOMATCH ) %]
60
		<li><strong>The passwords entered do not match</strong>. Please re-enter the new password.</li>
61
		[% END %]
62
		</ul>
63
		</div>
37
	[% END %]
64
	[% END %]
38
65
39
66
40
	<fieldset class="brief"><legend>Change Username and/or Password for [% firstname %] [% surname %]</legend>
67
	<fieldset class="brief"><legend>Change Username and/or Password for [% firstname %] [% surname %]</legend>
41
	<ol>
68
	<ol>
42
	<li><label for="newuserid">New Username:</label>
69
	<li><label for="newuserid">New Username:</label>
43
	<input type="hidden" name="member" value="[% member %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% userid %]" /></li>
70
	<input type="hidden" name="member" value="[% borrowernumber %]" /><input type="text" id="newuserid" name="newuserid" size="20" value="[% userid %]" /></li>
44
	<li><label for="newpassword">New Password:</label>
71
	<li><label for="newpassword">New Password:</label>
45
	<div class="hint">Koha cannot display existing passwords. Below is a randomly generated suggestion.  Leave the field blank to leave password unchanged.</div>
72
	<div class="hint">Koha cannot display existing passwords. Leave the field blank to leave password unchanged.</div>
46
	[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
73
	[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
47
	<input name="newpassword"  id="newpassword" type="text" size="20" value="[% defaultnewpassword %]" /></li>
74
	[% IF ( NOMATCH ) %]
75
	<input name="newpassword"  id="newpassword" type="password" size="20" class="focus" />
76
	<input name="newpassword" id="newpassword_random" readonly="readonly" disabled="disabled" type="hidden" />
77
	[% ELSE %]
78
	<input name="newpassword"  id="newpassword" type="password" size="20" />
79
	<input name="newpassword" readonly="readonly" disabled="disabled" type="hidden" />
80
	[% END %]
81
	</li>
82
	<li><label for="newpassword2">Confirm New Password:</label>
83
	<input name="newpassword2"  id="newpassword2" type="password" size="20" />
84
	<input name="newpassword2" id="newpassword2_random" readonly="readonly" disabled="disabled" type="hidden" />
85
	</li>
48
	</ol>
86
	</ol>
49
</fieldset>
87
</fieldset>
50
	<fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
88
	<fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-11 / +58 lines)
Lines 3-9 Link Here
3
[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] [% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %][% UNLESS ( opadd ) %] [% surname %], [% firstname %][% END %]</title>
3
[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] [% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %][% UNLESS ( opadd ) %] [% surname %], [% firstname %][% END %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'calendar.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
<script type="text/JavaScript" language="JavaScript">
6
<script type="text/JavaScript">
7
//<![CDATA[
7
//<![CDATA[
8
    $(document).ready(function() {
8
    $(document).ready(function() {
9
		$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
9
		$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
Lines 60-65 Link Here
60
        var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
60
        var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
61
        var MSG_MISSING_MANDATORY = _("The following fields are mandatory:");
61
        var MSG_MISSING_MANDATORY = _("The following fields are mandatory:");
62
        var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
62
        var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
63
        var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match");
63
//]]>
64
//]]>
64
</script>
65
</script>
65
<script type="text/javascript" src="[% themelang %]/js/members.js"></script>
66
<script type="text/javascript" src="[% themelang %]/js/members.js"></script>
Lines 143-148 Link Here
143
			[% IF ( ERROR_short_password ) %]
144
			[% IF ( ERROR_short_password ) %]
144
				<li id="ERROR_short_password">Password must be at least [% minPasswordLength %] characters long.</li>
145
				<li id="ERROR_short_password">Password must be at least [% minPasswordLength %] characters long.</li>
145
			[% END %]
146
			[% END %]
147
			[% IF ( ERROR_password_mismatch ) %]
148
				<li id="ERROR_password_mismatch">Passwords do not match.</li>
149
			[% END %]
146
            [% IF ( ERROR_extended_unique_id_failed ) %]
150
            [% IF ( ERROR_extended_unique_id_failed ) %]
147
                <li id="ERROR_extended_unique_id_failed">The attribute value 
151
                <li id="ERROR_extended_unique_id_failed">The attribute value 
148
                    [% ERROR_extended_unique_id_failed %] is already is use by another patron record.</li>
152
                    [% ERROR_extended_unique_id_failed %] is already is use by another patron record.</li>
Lines 1069-1107 Link Here
1069
			[% IF ( opadd ) %]
1073
			[% IF ( opadd ) %]
1070
			[% IF ( NoUpdateLogin ) %]
1074
			[% IF ( NoUpdateLogin ) %]
1071
				[% IF ( opduplicate ) %]
1075
				[% IF ( opduplicate ) %]
1072
					<input type="text" id="password" name="password" size="20"  disabled="disabled" />
1076
					<input type="password" id="password" name="password" size="20"  disabled="disabled" />
1073
				[% ELSE %]
1077
				[% ELSE %]
1074
					<input type="text" id="password" name="password" size="20"  disabled="disabled" value="[% password %]" />
1078
					<input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% password %]" />
1075
				[% END %]
1079
				[% END %]
1076
[% ELSE %]
1080
[% ELSE %]
1077
				[% IF ( opduplicate ) %]
1081
				[% IF ( opduplicate ) %]
1078
					<input type="text" id="password" name="password" size="20" />
1082
					<input type="password" id="password" name="password" size="20" />
1079
				[% ELSE %]
1083
				[% ELSE %]
1080
					<input type="text" id="password" name="password" size="20" value="[% password %]" />
1084
					<input type="password" id="password" name="password" size="20" value="[% password %]" />
1081
				[% END %]
1085
				[% END %]
1082
[% END %]
1086
[% END %]
1083
			[% ELSE %]
1087
			[% ELSE %]
1084
			[% IF ( password ) %]
1088
			[% IF ( password ) %]
1085
				[% IF ( NoUpdateLogin ) %]
1089
				[% IF ( NoUpdateLogin ) %]
1086
					<input type="text" id="password" name="password" size="20"  disabled="disabled" value="****" />
1090
					<input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
1087
				[% ELSE %]
1091
				[% ELSE %]
1088
					[% IF ( opduplicate ) %]
1092
					[% IF ( opduplicate ) %]
1089
						<input type="text" id="password" name="password" size="20" />
1093
						<input type="password" id="password" name="password" size="20" />
1090
					[% ELSE %]
1094
					[% ELSE %]
1091
						<input type="text" id="password" name="password" size="20" value="****" />
1095
						<input type="password" id="password" name="password" size="20" value="****" />
1092
					[% END %]
1096
					[% END %]
1093
				[% END %]
1097
				[% END %]
1094
			[% ELSE %]
1098
			[% ELSE %]
1095
				[% IF ( NoUpdateLogin ) %]
1099
				[% IF ( NoUpdateLogin ) %]
1096
					<input type="text" id="password" name="password" size="20"  disabled="disabled" value="" />
1100
					<input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
1097
				[% ELSE %]
1101
				[% ELSE %]
1098
					<input type="text" id="password" name="password" size="20" value="" />
1102
					<input type="password" id="password" name="password" size="20" value="" />
1099
				[% END %]
1103
				[% END %]
1100
			[% END %]
1104
			[% END %]
1101
			[% END %]
1105
			[% END %]
1102
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
1106
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
1103
[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
1107
[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
1104
		</li></ol>
1108
		</li>
1109
		<li>
1110
			[% IF ( mandatorypassword ) %]
1111
			<label for="password2" class="required">
1112
			[% ELSE %]
1113
			<label for="password2">
1114
			[% END %]
1115
			Confirm password: </label>
1116
			[% IF ( opadd ) %]
1117
			[% IF ( NoUpdateLogin ) %]
1118
				[% IF ( opduplicate ) %]
1119
					<input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
1120
				[% ELSE %]
1121
					<input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% password %]" />
1122
				[% END %]
1123
[% ELSE %]
1124
				[% IF ( opduplicate ) %]
1125
					<input type="password" id="password2" name="password2" size="20" />
1126
				[% ELSE %]
1127
					<input type="password" id="password2" name="password2" size="20" value="[% password %]" />
1128
				[% END %]
1129
[% END %]
1130
			[% ELSE %]
1131
			[% IF ( password ) %]
1132
				[% IF ( NoUpdateLogin ) %]
1133
					<input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
1134
				[% ELSE %]
1135
					[% IF ( opduplicate ) %]
1136
						<input type="password" id="password2" name="password2" size="20" />
1137
					[% ELSE %]
1138
						<input type="password" id="password2" name="password2" size="20" value="****" />
1139
					[% END %]
1140
				[% END %]
1141
			[% ELSE %]
1142
				[% IF ( NoUpdateLogin ) %]
1143
					<input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
1144
				[% ELSE %]
1145
					<input type="password" id="password2" name="password2" size="20" value="" />
1146
				[% END %]
1147
			[% END %]
1148
			[% END %]
1149
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1150
		</li>
1151
		</ol>
1105
		</fieldset>
1152
		</fieldset>
1106
		<!--this zones are not necessary in modif mode -->
1153
		<!--this zones are not necessary in modif mode -->
1107
		[% UNLESS ( opadd ) %]
1154
		[% UNLESS ( opadd ) %]
(-)a/members/member-password.pl (-18 / +18 lines)
Lines 40-56 $flagsrequired->{borrowers}=1; Link Here
40
my $member=$input->param('member');
40
my $member=$input->param('member');
41
my $cardnumber = $input->param('cardnumber');
41
my $cardnumber = $input->param('cardnumber');
42
my $destination = $input->param('destination');
42
my $destination = $input->param('destination');
43
my $errormsg;
43
my @errors;
44
my ($bor)=GetMember('borrowernumber' => $member);
44
my ($bor)=GetMember('borrowernumber' => $member);
45
if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) {
45
if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) {
46
	$errormsg = 'NOPERMISSION' unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} );
46
	push(@errors,'NOPERMISSION') unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} );
47
	# need superlibrarian for koha-conf.xml fakeuser.
47
	# need superlibrarian for koha-conf.xml fakeuser.
48
}
48
}
49
my $newpassword = $input->param('newpassword');
49
my $newpassword = $input->param('newpassword');
50
my $newpassword2 = $input->param('newpassword2');
51
52
push(@errors,'NOMATCH') if ( ( $newpassword && $newpassword2 ) && ($newpassword ne $newpassword2) );
53
50
my $minpw = C4::Context->preference('minPasswordLength');
54
my $minpw = C4::Context->preference('minPasswordLength');
51
$errormsg = 'SHORTPASSWORD' if( $newpassword && $minpw && (length($newpassword) < $minpw ) );
55
push(@errors,'SHORTPASSWORD') if( $newpassword && $minpw && (length($newpassword) < $minpw ) );
52
56
53
if ( $newpassword  && ! $errormsg ) {
57
if ( $newpassword  && !scalar(@errors) ) {
54
    my $digest=md5_base64($input->param('newpassword'));
58
    my $digest=md5_base64($input->param('newpassword'));
55
    my $uid = $input->param('newuserid');
59
    my $uid = $input->param('newuserid');
56
    my $dbh=C4::Context->dbh;
60
    my $dbh=C4::Context->dbh;
Lines 62-74 if ( $newpassword && ! $errormsg ) { Link Here
62
		    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
66
		    print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
63
		}
67
		}
64
    } else {
68
    } else {
65
			$errormsg = 'BADUSERID';
69
			push(@errors,'BADUSERID');
66
    	    $template->param(othernames => $bor->{'othernames'},
67
						surname     => $bor->{'surname'},
68
						firstname   => $bor->{'firstname'},
69
						userid      => $bor->{'userid'},
70
						defaultnewpassword => $newpassword 
71
						);
72
    }
70
    }
73
} else {
71
} else {
74
    my $userid = $bor->{'userid'};
72
    my $userid = $bor->{'userid'};
Lines 79-85 if ( $newpassword && ! $errormsg ) { Link Here
79
    for (my $i=0; $i<$length; $i++) {
77
    for (my $i=0; $i<$length; $i++) {
80
	$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
78
	$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
81
    }
79
    }
82
	
80
81
	$template->param( defaultnewpassword => $defaultnewpassword );
82
}
83
    if ( $bor->{'category_type'} eq 'C') {
83
    if ( $bor->{'category_type'} eq 'C') {
84
        my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
84
        my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
85
        my $cnt = scalar(@$catcodes);
85
        my $cnt = scalar(@$catcodes);
Lines 120-134 if (C4::Context->preference('ExtendedPatronAttributes')) { Link Here
120
	    userid      => $bor->{'userid'},
120
	    userid      => $bor->{'userid'},
121
	    destination => $destination,
121
	    destination => $destination,
122
		is_child        => ($bor->{'category_type'} eq 'C'),
122
		is_child        => ($bor->{'category_type'} eq 'C'),
123
	    defaultnewpassword => $defaultnewpassword,
123
        minPasswordLength => $minpw
124
	);
124
	);
125
125
126
if( scalar(@errors )){
127
	$template->param( errormsg => 1 );
128
	foreach my $error (@errors) {
129
        $template->param($error) || $template->param( $error => 1);
130
	}
126
131
127
}
132
}
128
133
129
$template->param( member => $member,
130
					errormsg => $errormsg,
131
					$errormsg => 1 ,
132
					minPasswordLength => $minpw );
133
134
output_html_with_http_headers $input, $cookie, $template->output;
134
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/memberentry.pl (-1 / +2 lines)
Lines 274-279 if ($op eq 'save' || $op eq 'insert'){ Link Here
274
  }
274
  }
275
  
275
  
276
  my $password = $input->param('password');
276
  my $password = $input->param('password');
277
  my $password2 = $input->param('password2');
278
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
277
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
279
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
278
280
279
  if (C4::Context->preference('ExtendedPatronAttributes')) {
281
  if (C4::Context->preference('ExtendedPatronAttributes')) {
280
- 

Return to bug 5280