Commit 684ca884 authored by Nigel McNie's avatar Nigel McNie
Browse files

Make the login form autofocus if an error occurs while logging in.

A bit of a hack - see the comment in the diff.
parent 2aa7ca06
......@@ -992,6 +992,15 @@ function auth_get_login_form() {
* @private
function get_login_form_js($form) {
// Add the autofocus class to the username input. This is because Mahara
// doesn't always render the login form when it is built. Sometimes, the
// form is built to process a login attempt, and then built again when that
// attempt fails. This makes sure that every time the login form is
// actually displayed it has the autofocus class.
$form = str_replace(
'class="required text" id="login_login_username"',
'class="required text autofocus" id="login_login_username"',
$form = str_replace('/', '\/', str_replace("'", "\'", (str_replace(array("\n", "\t"), '', $form))));
$strcookiesnotenabled = json_encode(get_string('cookiesnotenabled'));
$cookiename = get_config('cookieprefix') . 'ctest';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment