google / gitiles

A simple browser for Git repositories.
https://gerrit.googlesource.com/gitiles/
Other
582 stars 174 forks source link

gitiles missing login link when accessing a file #145

Open alonbl opened 6 years ago

alonbl commented 6 years ago

Redirected from: https://bugs.chromium.org/p/gerrit/issues/detail?id=9730 I thought it is the gerrit gitiles plugin. Following is the original description, please ignore that the gitiles is hosted under gerrit if it is not relevant.

When accessing a repository using:

https://host.com/gerrit/plugins/gitiles/@REPO@

If user is not authenticated, the top box presents:

|Gitiles|................................|Code Review|Sign In|

If user is authenticated, the top box presents:

|Gitiles|................................|Code Review|@USER@|Sign Out|

People can navigate to gerrit or perform sign in or sign out.

When trying to access a file directly while not authenticated or when access is denied, for example:

https://host.com/gerrit/plugins/gitiles/@REPO@/+/master/README.md

The return is HTTP error 404, no way to login.

This is not a friendly approach as people do send links directly to files within a repo, expecting the other side to be able to perform login and view the file without having to guess that it need to perform login to gerrit first then access the URL. The same top box should be displayed for all pages.

CURRENT BEHAVIOR

When access denied no way to authenticate (log in or logout)

EXPECTED BEHAVIOR

Top bar should always present logged in user (if any), allow to perform login or logout and also navigate to gerrit.

When performing login, the page should be refreshed so resource may be accessed if user has permissions.

Please fix this as it is annoying when sending people links into gitiles.

Thanks!

alonbl commented 5 years ago

PLEASE?

All our people suffers from this lack of functionality, sending links to protected repository result in blank screen, nobody knows what to do or what's wrong.

jrn commented 5 years ago

Can you say more about the proposed behavior? E.g. are you saying that every 404 should include a login link?

alonbl commented 5 years ago

Yes...

For authenticated users we have the following banner:

+-----------+-----------+------------+--------+
|Gitiles    |Code Review|Alon Bar-Lev|Sign Out|
+-----------+-----------+------------+--------+
<content>

I expect at least the following:

+-----------+-----------+------------+--------+
|Gitiles    |Code Review|            |Sign In |
+-----------+-----------+------------+--------+
Repository not found or access denied.
alonbl commented 5 years ago

After I've hacked the gitiles to show the banner in all cases, I found that by design everything works if returning unauthorized. So after six ours, I got to this[1] trivial fix. Please help us to provide good service to our users and review/merge asap.

[1] https://gerrit-review.googlesource.com/c/gitiles/+/211312