ValidatePassword returns true if the given password matches the encoded version with given salt.
(encoded, salt, password string)
| 127 | // ValidatePassword returns true if the given password matches the encoded |
| 128 | // version with given salt. |
| 129 | func 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. |
| 135 | func MailResendCacheKey(userID int64) string { |