-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix prohibit login check on authorization #6106
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6106 +/- ##
==========================================
- Coverage 38.88% 38.86% -0.03%
==========================================
Files 349 349
Lines 49755 49801 +46
==========================================
+ Hits 19349 19355 +6
- Misses 27611 27646 +35
- Partials 2795 2800 +5
Continue to review full report at Codecov.
|
models/login_source.go
Outdated
@@ -642,6 +642,12 @@ func UserSignIn(username, password string) (*User, error) { | |||
} | |||
|
|||
if hasUser { | |||
if !user.IsActive { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be checked only after username&password is validated otherwise usernames can be leaked/guessed from private servers
Oh, and also |
@lafriks done. |
@@ -113,6 +113,6 @@ func TestCreateReleasePaging(t *testing.T) { | |||
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.12", i18n.Tr("en", "repo.release.draft"), 10) | |||
|
|||
// Check that user3 does not see draft and still see 10 latest releases | |||
session2 := loginUser(t, "user3") | |||
session2 := loginUser(t, "user4") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change comment above to reference user4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing, but otherwise looks great!
925c303
to
9927680
Compare
@lunny please backport |
* fix bug prohibit login not applied on dashboard * fix tests * fix bug user status leak * fix typo * return after render
Before this PR, a prohibit login account also can login and see the dashboard page. This PR will add more checks to fix that.