mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Cleanup models.User.HashPassword (#3334)
This commit is contained in:
committed by
Lauris BH
parent
9aed18073d
commit
e5b8b4b5ec
@ -135,13 +135,11 @@ func TestHashPasswordDeterministic(t *testing.T) {
|
||||
pass := string(b)
|
||||
|
||||
// save the current password in the user - hash it and store the result
|
||||
u.Passwd = pass
|
||||
u.HashPassword()
|
||||
u.HashPassword(pass)
|
||||
r1 := u.Passwd
|
||||
|
||||
// run again
|
||||
u.Passwd = pass
|
||||
u.HashPassword()
|
||||
u.HashPassword(pass)
|
||||
r2 := u.Passwd
|
||||
|
||||
// assert equal (given the same salt+pass, the same result is produced)
|
||||
@ -158,7 +156,6 @@ func BenchmarkHashPassword(b *testing.B) {
|
||||
u := &User{Salt: string(bs), Passwd: pass}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
u.HashPassword()
|
||||
u.Passwd = pass
|
||||
u.HashPassword(pass)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user