Do not use o=ALL_EMAILS parameter.
For security reason, this REST API parameter needs account modification permission to get all email addresses. Now changed to ask only account number to verify an email address. Bug: 79863374 Test: test with existing OWNERS Change-Id: Ic913b7ad96a69c35d1d91e5871f4c5636e73533d
This commit is contained in:
@@ -30,12 +30,11 @@ def echo(msg):
|
||||
|
||||
def find_address(address):
|
||||
if address not in checked_addresses:
|
||||
request = (gerrit_server + '/accounts/?n=1&o=ALL_EMAILS&q=email:'
|
||||
request = (gerrit_server + '/accounts/?n=1&q=email:'
|
||||
+ urllib.quote(address))
|
||||
echo('Checking email address: ' + address)
|
||||
result = urllib2.urlopen(request).read()
|
||||
checked_addresses[address] = (
|
||||
result.find('"email":') >= 0 and result.find('"_account_id":') >= 0)
|
||||
checked_addresses[address] = result.find('"_account_id":') >= 0
|
||||
return checked_addresses[address]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user