Skip to content

Cleanup models.User.HashPassword #3334

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

Merged
merged 3 commits into from
Jan 11, 2018
Merged

Cleanup models.User.HashPassword #3334

merged 3 commits into from
Jan 11, 2018

Conversation

bkcsoft
Copy link
Member

@bkcsoft bkcsoft commented Jan 8, 2018

Makes it deterministic even if ran twice.

Something like this would previously break the users password:

u.Passwd = "foobar"
u.HashPassword()
u.HashPassword()

@bkcsoft bkcsoft requested a review from thehowl January 8, 2018 22:47
models/user.go Outdated
@@ -711,7 +714,8 @@ func CreateUser(u *User) (err error) {
if u.Salt, err = GetUserSalt(); err != nil {
return err
}
u.HashPassword()
tempPassword := u.Passwd
u.HashPassword(tempPassword)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why variable tempPassword is needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably isn't 🤔

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 8, 2018
@lafriks lafriks added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Jan 9, 2018
@lafriks lafriks modified the milestones: 1.3.3, 1.4.0 Jan 9, 2018
@lunny
Copy link
Member

lunny commented Jan 9, 2018

LGTM except @lafriks ' comment.

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 9, 2018
@codecov-io
Copy link

Codecov Report

Merging #3334 into master will increase coverage by <.01%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3334      +/-   ##
==========================================
+ Coverage   35.04%   35.05%   +<.01%     
==========================================
  Files         280      280              
  Lines       40556    40553       -3     
==========================================
+ Hits        14211    14214       +3     
+ Misses      24239    24233       -6     
  Partials     2106     2106
Impacted Files Coverage Δ
cmd/admin.go 0% <0%> (ø) ⬆️
routers/user/auth.go 14.95% <0%> (+0.01%) ⬆️
routers/api/v1/admin/user.go 23.4% <0%> (+0.09%) ⬆️
routers/admin/users.go 13.43% <0%> (+0.06%) ⬆️
models/user.go 40.21% <100%> (+0.12%) ⬆️
routers/user/setting.go 24.75% <100%> (-0.13%) ⬇️
modules/indexer/indexer.go 70% <0%> (-7.5%) ⬇️
models/repo_indexer.go 51.45% <0%> (-1.46%) ⬇️
models/repo.go 43.37% <0%> (+0.18%) ⬆️
models/repo_list.go 67.18% <0%> (+1.56%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 674cfb7...3435bf7. Read the comment docs.

Copy link
Contributor

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for lafrik's note

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 9, 2018
@lafriks
Copy link
Member

lafriks commented Jan 11, 2018

Make LG-TM work

@lafriks lafriks merged commit e5b8b4b into master Jan 11, 2018
@lafriks lafriks deleted the cleanup-user-hashpassword branch January 11, 2018 22:19
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants