user_cache.go 525 B

12345678910111213141516
  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. // MailResendCacheKey returns key used for cache mail resend.
  6. func (u *User) MailResendCacheKey() string {
  7. return "MailResend_" + u.IDStr()
  8. }
  9. // TwoFactorCacheKey returns key used for cache two factor passcode.
  10. // e.g. TwoFactor_1_012664
  11. func (u *User) TwoFactorCacheKey(passcode string) string {
  12. return "TwoFactor_" + u.IDStr() + "_" + passcode
  13. }