File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -35,25 +35,27 @@ function get_content () {
35
35
// TODO: now that we have multiauth it is hard to find out if there is a way to change password
36
36
$ forgot = $ wwwroot . '/login/forgot_password.php ' ;
37
37
38
+ if (empty ($ CFG ->xmlstrictheaders ) and !empty ($ CFG ->loginpasswordautocomplete )) {
39
+ $ autocomplete = 'autocomplete="off" ' ;
40
+ } else {
41
+ $ autocomplete = '' ;
42
+ }
43
+
38
44
$ username = get_moodle_cookie ();
39
45
40
46
$ this ->content ->footer = '' ;
41
47
$ this ->content ->text = '' ;
42
48
43
49
if (!isloggedin () or isguestuser ()) { // Show the block
44
50
45
- $ this ->content ->text .= "\n" .'<form class="loginform" id="login" method="post" action=" ' .get_login_url ().'"> ' ;
51
+ $ this ->content ->text .= "\n" .'<form class="loginform" id="login" method="post" action=" ' .get_login_url ().'" ' . $ autocomplete . ' > ' ;
46
52
47
53
$ this ->content ->text .= '<div class="c1 fld username"><label for="login_username"> ' .get_string ('username ' ).'</label> ' ;
48
54
$ this ->content ->text .= '<input type="text" name="username" id="login_username" value=" ' .s ($ username ).'" /></div> ' ;
49
55
50
56
$ this ->content ->text .= '<div class="c1 fld password"><label for="login_password"> ' .get_string ('password ' ).'</label> ' ;
51
57
52
- if (!empty ($ CFG ->loginpasswordautocomplete )) {
53
- $ this ->content ->text .= '<input type="password" name="password" id="login_password" value="" autocomplete="off" /></div> ' ;
54
- } else {
55
- $ this ->content ->text .= '<input type="password" name="password" id="login_password" value="" /></div> ' ;
56
- }
58
+ $ this ->content ->text .= '<input type="password" name="password" id="login_password" value="" ' .$ autocomplete .' /></div> ' ;
57
59
58
60
if (isset ($ CFG ->rememberusername ) and $ CFG ->rememberusername == 2 ) {
59
61
$ checked = $ username ? 'checked="checked" ' : '' ;
Original file line number Diff line number Diff line change 613
613
$ string ['loginhttps ' ] = 'Use HTTPS for logins ' ;
614
614
$ string ['loginpageautofocus ' ] = 'Autofocus login page form ' ;
615
615
$ string ['loginpageautofocus_help ' ] = 'Enabling this option improves usability of the login page, but automatically focusing fields may be considered an accessibility issue. ' ;
616
- $ string ['loginpasswordautocomplete ' ] = 'Prevent password autocompletion on login form. ' ;
616
+ $ string ['loginpasswordautocomplete ' ] = 'Prevent password autocompletion on login form ' ;
617
617
$ string ['loginpasswordautocomplete_help ' ] = 'Having this off will let users save their account password in their browser. Switching this setting on will result in your site no longer following XHTML strict validation rules. ' ;
618
618
$ string ['loglifetime ' ] = 'Keep logs for ' ;
619
619
$ string ['longtimewarning ' ] = '<b>Please note that this process can take a long time.</b> ' ;
Original file line number Diff line number Diff line change 4
4
} else {
5
5
$columns = 'onecolumn';
6
6
}
7
+
8
+ if (empty($CFG-> xmlstrictheaders) and !empty($CFG-> loginpasswordautocomplete)) {
9
+ $autocomplete = 'autocomplete="off"';
10
+ } else {
11
+ $autocomplete = '';
12
+ }
7
13
?>
8
14
< div class ="loginbox clearfix <?php echo $columns ?> ">
9
15
< div class ="loginpanel ">
@@ -29,7 +35,7 @@ <h2><?php print_string("returningtosite") ?></h2>
29
35
echo '</ div > ';
30
36
}
31
37
?>
32
- < form action ="<?php echo $CFG->httpswwwroot; ?>/login/index.php " method ="post " id ="login ">
38
+ < form action ="<?php echo $CFG->httpswwwroot; ?>/login/index.php " method ="post " id ="login " < ?php echo $autocomplete; ? > >
33
39
< div class ="loginform ">
34
40
< div class ="form-label "> < label for ="username "> < ?php print_string("username") ?> </ label > </ div >
35
41
< div class ="form-input ">
@@ -38,7 +44,7 @@ <h2><?php print_string("returningtosite") ?></h2>
38
44
< div class ="clearer "> <!-- --> </ div >
39
45
< div class ="form-label "> < label for ="password "> < ?php print_string("password") ?> </ label > </ div >
40
46
< div class ="form-input ">
41
- < input type ="password " name ="password " id ="password " size ="15 " value ="" < ?php if (!empty($CFG- > loginpasswordautocomplete)) { echo ' autocomplete="off"';} ?> />
47
+ < input type ="password " name ="password " id ="password " size ="15 " value ="" < ?php echo $ autocomplete; ?> />
42
48
< input type ="submit " id ="loginbtn " value ="<?php print_string( "login ") ?> " />
43
49
</ div >
44
50
< div class ="clearer "> <!-- --> </ div >
You can’t perform that action at this time.
0 commit comments