Page MenuHomePhabricator

Discrepancy between local and global email status
Closed, ResolvedPublic

Description

wikiadmin@10.64.48.109(centralauth)> select gu_email, gu_email_authenticated from globaluser where gu_name = 'Vikkvakk';
+----------------+------------------------+
| gu_email       | gu_email_authenticated |
+----------------+------------------------+
| <redacted>     | 20080815191602         |
+----------------+------------------------+

wikiadmin@10.64.48.153(metawiki)> select user_email, user_email_authenticated from user where user_name = 'Vikkvakk';
+------------+--------------------------+
| user_email | user_email_authenticated |
+------------+--------------------------+
|            | NULL                     |
+------------+--------------------------+


tgr@mwmaint1002:~$ mwscript shell.php metawiki
>>> $u = User::newFromName('Vikkvakk')
>>> $u->isEmailConfirmed()
=> false

This results in the OAuth /identfy endpoint response claiming that the user does not have a confirmed email address, which (among other things) blocks login on a Discourse instance.

Event Timeline

To confirm, the issue is that the "user_email" value is missing, not that user_email_authenticated is NULL, right?

For comparison, here's my personal account, created in 2011:

wikiadmin@10.64.48.153(metawiki)> select user_email, user_email_authenticated from user where user_name = 'MyRedactedUserName';
+------------------+--------------------------+
| user_email       | user_email_authenticated |
+------------------+--------------------------+
| MyRedactedEmail | NULL                     |
+------------------+--------------------------+

wikiadmin@10.64.0.91(centralauth)> select gu_email, gu_email_authenticated from globaluser where gu_name = 'MyRedactedUserName';
+------------------+------------------------+
| gu_email         | gu_email_authenticated |
+------------------+------------------------+
| MyRedactedEmail | 20110104065549         |
+------------------+------------------------+

>>> bpirkle@mwmaint1002:~$ mwscript shell.php metawiki
>>> $u = User::newFromName('MyRedactedUserName')
>>> $u->isEmailConfirmed()
=> true

My actual email address appears in both centralauth and metawiki databases. (If anyone debugging this would like my actual personal user name / email for debugging purposes, let me know.)

I can happily go to https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose on that account.

wikiadmin@10.64.48.109(metawiki)> select user_email from user order by user_id DESC limit 50;

There are 8 empty rows in the above query.

Well, in theory either of those could be an issue. But also in theory, CentralAuth should override all relevant User methods via hooks like UserGetEmail and UserGetEmailAuthenticationTimestamp and local data shouldn't really matter. So I'm not really sure what is (was?) going on here.

apaskulin added a subscriber: AMooney.

Adding this to Clinic Duty since it is blocking the API Portal (T269880). CC: @AMooney

It's because isEmailConfirmed() validates the email address according to $this->mEmail. But that is not properly populated by $this->load() as expected, it is lazy-loaded from CA in getEmail().

Change 655797 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] Use User::getEmail() not mEmail

https://gerrit.wikimedia.org/r/655797

Change 655797 merged by jenkins-bot:
[mediawiki/core@master] Use User::getEmail() not mEmail

https://gerrit.wikimedia.org/r/655797