Skip to content

Commit

Permalink
Merge branch 'MDL-35817_m23' of git://github.com/rwijaya/moodle into …
Browse files Browse the repository at this point in the history
…MOODLE_23_STABLE
  • Loading branch information
Sam Hemelryk committed Jan 20, 2013
2 parents cfdc33b + e99486c commit cf7ace8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions lib/javascript-static.js
Expand Up @@ -813,6 +813,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('#loginerrormessage');

if (errorlog) {
errorlog.focus();
}
}
/**
* Adds lightbox hidden element that covers the whole node.
*
Expand Down
4 changes: 3 additions & 1 deletion login/index.php
Expand Up @@ -345,7 +345,9 @@
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);
}
Expand Down
5 changes: 3 additions & 2 deletions login/index_form.html
Expand Up @@ -30,9 +30,10 @@ <h2><?php print_string("returningtosite") ?></h2>
</div>
<?php
if (!empty($errormsg)) {
echo '<div class="loginerrors">';
echo html_writer::start_tag('div', array('class' => 'loginerrors'));
echo html_writer::link('#', $errormsg, array('id' => 'loginerrormessage', 'class' => 'accesshide'));
echo $OUTPUT->error_text($errormsg);
echo '</div>';
echo html_writer::end_tag('div');
}
?>
<form action="<?php echo $CFG->httpswwwroot; ?>/login/index.php" method="post" id="login" <?php echo $autocomplete; ?> >
Expand Down

0 comments on commit cf7ace8

Please sign in to comment.