Link to the new password URL when authentication fails

Instead of just telling users their credentials are missing, link them to the new password URL so they can fix it.

Change-Id: I9559868ae948e6d18cef1205083aee0ad5c2489a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5665862
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Auto-Submit: Gavin Mak <gavinmak@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
changes/62/5665862/3
Gavin Mak 11 months ago committed by LUCI CQ
parent 99548b292d
commit 280b823136

@ -994,7 +994,7 @@ def ReadHttpResponse(conn: HttpConn,
# Help the type checker a bit here - it can't figure out the `except` logic
# in the loop above.
assert response, (
"Impossible: End of retry loop without response or exception.")
'Impossible: End of retry loop without response or exception.')
if response.status in accept_statuses:
return StringIO(contents)
@ -1006,8 +1006,10 @@ def ReadHttpResponse(conn: HttpConn,
else:
auth_match = re.search('realm="([^"]+)"', www_authenticate, re.I)
host = auth_match.group(1) if auth_match else conn.req_host
new_password_url = CookiesAuthenticator.get_new_password_url(host)
print('Authentication failed. Please make sure your .gitcookies '
'file has credentials for %s.' % host)
f'file has credentials for {host}.')
print(f'(Re)generate credentials here: {new_password_url}')
print('Try:\n git cl creds-check')
reason = '%s: %s' % (response.reason, contents)

Loading…
Cancel
Save