diff options
Diffstat (limited to 'internal/userutil/userutil.go')
-rw-r--r-- | internal/userutil/userutil.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/userutil/userutil.go b/internal/userutil/userutil.go index d8a8b031..6d324ff6 100644 --- a/internal/userutil/userutil.go +++ b/internal/userutil/userutil.go @@ -122,3 +122,13 @@ func ValidatePassword(encoded, salt, password string) bool { got := EncodePassword(password, salt) return subtle.ConstantTimeCompare([]byte(encoded), []byte(got)) == 1 } + +// MailResendCacheKey returns the key used for caching mail resend. +func MailResendCacheKey(userID int64) string { + return fmt.Sprintf("mailResend::%d", userID) +} + +// TwoFactorCacheKey returns the key used for caching two factor passcode. +func TwoFactorCacheKey(userID int64, passcode string) string { + return fmt.Sprintf("twoFactor::%d::%s", userID, passcode) +} |