← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

An idea concerning testing credentials for validity

 

Hello everyone!

I've been recently thinking about two bugs in the Accomplishments
Viever, but I believe they are affecting the whole project. I've come
up with quite a complex idea that needs to be discussed, so I decided
to post to the list instead of commenting on them.


These bugs are:
   #951224 "no warning when enter wrong email address"
   #974558 "No validity checking on extra information"

They both relate to the problem that emerges when the user
accidentally enters invalid credentials when asked. It is very hard to
recognise that they are wrong, as the symptoms are just as if the user
never accomplished anything.

In particular, the first's bug's reporter complains "If you enter
wrong email, it just keeps checking, so it took me while to figure out
that I changed my LP email to different one."

And there is quite a problem with this bug. Actually, the scripts will
never know that the user have entered a wrong e-mail, because the
result will be just the same as if he did not register on launchpad.
For example the 'registered-on-launchpad' script simply checks if a
person with given e-mail has an account, otherwise returns 1 - "not
accomplished".
In this case it is impossible to determine whether provided
credentials are not valid, or just the user has not yet registered.

On the other hand, if the user provides the launchpad-email, then it
means that he has already registered. This means the
registered-on-launchpad accomplishment is pointless, because how can
one enter his launchpad-email without being registered on it? If we
got rid of that particular accomplishment, then validity check would
make more sense, as we might warn that scripts were unable to get your
data, as there is no user on launchpad with given credentials.
This may however turn into a dead-end, and is no really a solution.
Most importantly it would enforce accomplishment sets developers to
somehow define whether they need some particular extra-information, or
is it optional (in case of ubuntu-community set some accomplishments
are achievable *without* a LP account). We would have then to assume
that the data user has entered is correct, and this does not give us
much possibilities to verify it.

Another approach is to allow the scripts to return yet another exit
code, stating that the extra-information the script was provided with
is invalid. This isn't the coolest solution, for such information is
not much helpful without even a tiniest textual explanation for the
user.

If the scripts were allowed to check credentials for validity, then
why not also check it's formatting etc.? The problem of
extra-information being in a correct format has been already
considered, that's bug #974558. It has been suggested to either use
regular expressions or some formatting rules. But if the script
checked for validity, then why also not to report problems , if f.e.
data contains invalid characters?

But more importantly, why would all the scripts need to re-do the same things?


This way I came into conclusion that the problem is not that the
scripts are unable to warn in case of problems with the credentials,
but the extra-information itself. The credentials reasonableness is a
extra-information's-specific feature, and not accomplishment-specific,
right?

The point is that the specific extra-information entries are not well
defined. Actually, they are not defined at all, they just have a name
(and description). Instead of checking the correctness of credentials
while running the scripts, that should be done when the user provides
it. That makes more sense in the GUI too, otherwise the user would be
notified about problems when the scripts are run, while warning him as
soon as he types it is more logical approach.

My proposal is to provide a python script for each extra-information
entry. These scripts would be included in
ubuntu-accomplishments-extra-information, and would be responsible for
checking credentials. Things they might test include correct
formatting, matching some regular expression (in case it's e-mail
adress), checking whether such user exist (in case of launchpad user
data), and whatever else is needed to ensure that this data is
correct. Ideally, they would provide a textual explanation why is this
data incorrect, just to improve user experience. Of course such
scripts are optional, extra-information fields without a related
script would be treated as correct by default and not checked for
validity.

Advantages?
 - Accomplishments developers would be safe to assume that the
provided extra-information is correct.
 - Such script would be run only once - when the user types in the
data - and it's code is not duplicated in accomplishment scripts.
 - The user would be immidiatelly informed about it's correctness,
which is very friendly. The GUI might display a red error icon next to
invalid data, or anything else.
 - Unlike suggestions about using rules or regular expressions, this
approach is limitlessly extendible.
 - This approach clearly defines what exactly a particlular
extra-information entry is, and what format etc. the data passed to
script uses - handy for accomplishment developers, clean in
maintenance.


I believe this idea is worth sharing. What are your thoughs? Does that
make sense?

Regards,
Rafał Cieślak


Follow ups