Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-21018

Mnet - link to mnet_email.php shows when it shouldn't

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.7
    • Fix Version/s: 1.9.8, 2.0
    • Component/s: Authentication, MNet
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      when Mnet is enabled, if a user gets their password wrong on the login screen a link to Mnet_email is always shown even when SSO to Moodle isn't configured - if a site is only configured to allow their users to SSO to other sites - not the other way round, Moodle shouldn't show the link as it's useless - here's a patch that fixes it:

      — a/login/index.php
      +++ b/login/index.php
      @@ -238,7 +238,8 @@ httpsrequired();
      // TODO: if the user failed to authenticate, check if the username
      if ( !empty($CFG->mnet_dispatcher_mode)
      && $CFG->mnet_dispatcher_mode === 'strict'

      • && is_enabled_auth('mnet'))
        Unknown macro: {+ && is_enabled_auth('mnet') &&+ record_exists('mnet_host2service', 'publish', '1', 'serviceid', get_field('mnet_service', 'id', 'name', 'sso_sp')) ) { $errormsg .= get_string('loginlinkmnetuser', 'mnet', "mnet_email.php?u=$frm->username"); } }

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              danmarsden Dan Marsden added a comment -

              hmm... that patch only partially fixes it - when an Mnet Peer is deleted, it just flags them as deleted and doesn't remove the records - so we need to check for records that exist for hosts with deleted set to 0 - will try to create an improved patch sometime today.

              Show
              danmarsden Dan Marsden added a comment - hmm... that patch only partially fixes it - when an Mnet Peer is deleted, it just flags them as deleted and doesn't remove the records - so we need to check for records that exist for hosts with deleted set to 0 - will try to create an improved patch sometime today.
              Hide
              danmarsden Dan Marsden added a comment -

              here's a better one instead of the record_exists call

              record_exists_sql("SELECT h.id from {$CFG->prefix}mnet_host h
              INNER JOIN {$CFG->prefix}mnet_host2service m ON h.id=m.hostid
              INNER JOIN {$CFG->prefix}mnet_service s ON s.id=m.serviceid
              WHERE s.name='sso_sp' AND h.deleted=0 AND m.publish = 1;") ) {

              Show
              danmarsden Dan Marsden added a comment - here's a better one instead of the record_exists call record_exists_sql("SELECT h.id from {$CFG->prefix}mnet_host h INNER JOIN {$CFG->prefix}mnet_host2service m ON h.id=m.hostid INNER JOIN {$CFG->prefix}mnet_service s ON s.id=m.serviceid WHERE s.name='sso_sp' AND h.deleted=0 AND m.publish = 1;") ) {
              Hide
              danmarsden Dan Marsden added a comment -

              oops - bad copy paste - shouldn't have the semicolon at the end!
              record_exists_sql("SELECT h.id from {$CFG->prefix}mnet_host h
              INNER JOIN {$CFG->prefix}mnet_host2service m ON h.id=m.hostid
              INNER JOIN {$CFG->prefix}mnet_service s ON s.id=m.serviceid
              WHERE s.name='sso_sp' AND h.deleted=0 AND m.publish = 1") ) {

              Show
              danmarsden Dan Marsden added a comment - oops - bad copy paste - shouldn't have the semicolon at the end! record_exists_sql("SELECT h.id from {$CFG->prefix}mnet_host h INNER JOIN {$CFG->prefix}mnet_host2service m ON h.id=m.hostid INNER JOIN {$CFG->prefix}mnet_service s ON s.id=m.serviceid WHERE s.name='sso_sp' AND h.deleted=0 AND m.publish = 1") ) {
              Hide
              mjollnir Penny Leach added a comment -

              thanks, I committed that fix along with a username/host check to stable & head.

              Show
              mjollnir Penny Leach added a comment - thanks, I committed that fix along with a username/host check to stable & head.
              Hide
              danmarsden Dan Marsden added a comment -

              Thanks Penny, wanted someone else to review this - btw, isn't it testing Tuesday?

              Show
              danmarsden Dan Marsden added a comment - Thanks Penny, wanted someone else to review this - btw, isn't it testing Tuesday?
              Hide
              mjollnir Penny Leach added a comment -

              argh! I didn't get an email about it though! I forgot!

              Show
              mjollnir Penny Leach added a comment - argh! I didn't get an email about it though! I forgot!

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Mar/10