MDL-35817 Login: set page focus to error message for login error
This commit is contained in:
@@ -854,6 +854,16 @@ M.util.focus_login_form = function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set focus on login error message
|
||||
*/
|
||||
M.util.focus_login_error = function(Y) {
|
||||
var errorlog = Y.one('#errormsg');
|
||||
|
||||
if (errorlog) {
|
||||
errorlog.focus();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds lightbox hidden element that covers the whole node.
|
||||
*
|
||||
|
||||
+3
-1
@@ -345,7 +345,9 @@ if (isloggedin() and !isguestuser()) {
|
||||
echo $OUTPUT->box_end();
|
||||
} else {
|
||||
include("index_form.html");
|
||||
if (!empty($CFG->loginpageautofocus)) {
|
||||
if ($errormsg) {
|
||||
$PAGE->requires->js_init_call('M.util.focus_login_error', null, true);
|
||||
} else if (!empty($CFG->loginpageautofocus)) {
|
||||
//focus username or password
|
||||
$PAGE->requires->js_init_call('M.util.focus_login_form', null, true);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ if (!empty($CFG->loginpasswordautocomplete)) {
|
||||
<?php
|
||||
if (!empty($errormsg)) {
|
||||
echo '<div class="loginerrors">';
|
||||
echo '<a id="errormsg" class="accesshide" href="#">'.$OUTPUT->error_text($errormsg).'</a>';
|
||||
echo $OUTPUT->error_text($errormsg);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user