← Back to team overview

mahara-contributors team mailing list archive

[Bug 891383] Re: Login form requires Javascript

 

To fix this, we need to remove the function get_login_form_js, which is
used to generate the sidebar login form, and the login form for the
login page. It is also used in the saml authentication plugin. The
contents of the function are as follows:


/**
 * Returns javascript to assist with the rendering of the login forms. The
 * javascript is used to detect whether cookies are enabled, and not show the
 * login form if they are not.
 *
 * @param string  $form A rendered login form
 * @return string The form with extra javascript added for cookie detection
 * @private
 */
function get_login_form_js($form) {
    $form = str_replace('/', '\/', str_replace("'", "\'", (str_replace(array("\n", "\t"), '', $form))));
    $strcookiesnotenabled    = json_encode(get_string('cookiesnotenabled'));
    $cookiename = get_config('cookieprefix') . 'ctest';
    return <<<EOF
<script type="text/javascript">
var loginbox = $('loginform_container');
document.cookie = "$cookiename=1";
if (document.cookie) {
    loginbox.innerHTML = '$form';
    document.cookie = '$cookiename=1;expires=1/1/1990 00:00:00';
}
else {
    replaceChildNodes(loginbox, P(null, $strcookiesnotenabled));
}
</script>
EOF;
}


The cookie check fails though.. so it doesn't serve much purpose at all, and I think starting to get rid of the js requirement is a good idea

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/891383

Title:
  Login form requires Javascript

Status in Mahara ePortfolio:
  Triaged

Bug description:
  The login form requires javascript to be enabled, yet this should be
  the case. With some small code hacking to remove the js form and
  disable js I can still login fine.

  The js wrapper to the login form is meant to check whether cookies are
  enabled, but it seems that it doesn't do that...

  Message displayed to the user if js is disabled is
   'Your browser does not have javascript enabled for this site. Mahara requires javascript to be enabled before you can log in'

  I would recommend removing the dependency on javascript for login,
  make the assumtion that cookies are enabled (if they aren't the user
  will quickly find out! as they will have to relogin after every page).

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/891383/+subscriptions


Follow ups

References