← Back to team overview

mahara-contributors team mailing list archive

[Bug 1246547] [NEW] Give a different error message for an expired registration key than for an invalid registration key

 

Public bug reported:

In the optional self-registration process, users can fill in their email
address to register an account, and then Mahara sends them an email with
a registration link in it that contains a unique key. They click on that
in order to complete the registration process.

The problem is that the code for this checks on two conditions at once,
and prints out only one error message for both of them.

    if (!$registration = get_record_select('usr_registration', '"key" = ? AND expiry >= ? AND pending != 1', array($key, db_format_timestamp(time())))) {
        die_info(get_string('registrationnosuchkey', 'auth.internal'));
    }

... and ...

 $string['registrationnosuchkey'] = 'Sorry, there does not seem to be a
registration with this key. Perhaps you waited longer than 24 hours to
complete your registration? Otherwise, it might be our fault.';

In
https://mahara.org/interaction/forum/topic.php?id=5860&offset=0&limit=10#post25010
there seems to be a case where the registration key is bad, but the
error message confuses matters by making it seem as if it's a time-
related issue. It would be a simple and useful step to change this into
two checks instead.

1. Attempt to retrieve the usr_registration record with the matching
key.

2. If no record is found, print an error message saying we don't have a
key that matches your link, perhaps your email program mangled it?

3. If a usr_registration record is found, compare the value of its
"expiry" field with current server time, and if it has expired show the
user the message that says "sorry, this key has expired."

** Affects: mahara
     Importance: Wishlist
         Status: Confirmed


** Tags: bite-sized registration

** Summary changed:

- Give a separate error message for an expired registration key or an invalid registration key
+ Give a different error message for an expired registration key than for an invalid registration key

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1246547

Title:
  Give a different error message for an expired registration key than
  for an invalid registration key

Status in Mahara ePortfolio:
  Confirmed

Bug description:
  In the optional self-registration process, users can fill in their
  email address to register an account, and then Mahara sends them an
  email with a registration link in it that contains a unique key. They
  click on that in order to complete the registration process.

  The problem is that the code for this checks on two conditions at
  once, and prints out only one error message for both of them.

      if (!$registration = get_record_select('usr_registration', '"key" = ? AND expiry >= ? AND pending != 1', array($key, db_format_timestamp(time())))) {
          die_info(get_string('registrationnosuchkey', 'auth.internal'));
      }

  ... and ...

   $string['registrationnosuchkey'] = 'Sorry, there does not seem to be
  a registration with this key. Perhaps you waited longer than 24 hours
  to complete your registration? Otherwise, it might be our fault.';

  In
  https://mahara.org/interaction/forum/topic.php?id=5860&offset=0&limit=10#post25010
  there seems to be a case where the registration key is bad, but the
  error message confuses matters by making it seem as if it's a time-
  related issue. It would be a simple and useful step to change this
  into two checks instead.

  1. Attempt to retrieve the usr_registration record with the matching
  key.

  2. If no record is found, print an error message saying we don't have
  a key that matches your link, perhaps your email program mangled it?

  3. If a usr_registration record is found, compare the value of its
  "expiry" field with current server time, and if it has expired show
  the user the message that says "sorry, this key has expired."

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


Follow ups

References