MCPcopy Create free account
hub / github.com/gogs/gogs / ValidatePassword

Function ValidatePassword

internal/userutil/userutil.go:129–132  ·  view source on GitHub ↗

ValidatePassword returns true if the given password matches the encoded version with given salt.

(encoded, salt, password string)

Source from the content-addressed store, hash-verified

127// ValidatePassword returns true if the given password matches the encoded
128// version with given salt.
129func ValidatePassword(encoded, salt, password string) bool {
130 got := EncodePassword(password, salt)
131 return subtle.ConstantTimeCompare([]byte(encoded), []byte(got)) == 1
132}
133
134// MailResendCacheKey returns the key used for caching mail resend.
135func MailResendCacheKey(userID int64) string {

Callers 4

AuthenticateMethod · 0.92
usersUpdateFunction · 0.92
SettingsPasswordPostFunction · 0.92
TestValidatePasswordFunction · 0.85

Calls 1

EncodePasswordFunction · 0.85

Tested by 2

usersUpdateFunction · 0.74
TestValidatePasswordFunction · 0.68