user_cache.go 558 B

1234567891011121314151617181920
  1. // Copyright 2018 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package db
  5. import (
  6. "fmt"
  7. )
  8. // MailResendCacheKey returns key used for cache mail resend.
  9. func (u *User) MailResendCacheKey() string {
  10. return fmt.Sprintf("MailResend_%d", u.ID)
  11. }
  12. // TwoFactorCacheKey returns key used for cache two factor passcode.
  13. // e.g. TwoFactor_1_012664
  14. func (u *User) TwoFactorCacheKey(passcode string) string {
  15. return fmt.Sprintf("TwoFactor_%d_%s", u.ID, passcode)
  16. }