user_cache.go 623 B

12345678910111213141516171819
  1. // Copyright 2015 - Present, The Gogs Authors. All rights reserved.
  2. // Copyright 2018 - Present, Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package models
  7. // MailResendCacheKey returns key used for cache mail resend.
  8. func (u *User) MailResendCacheKey() string {
  9. return "MailResend_" + u.IDStr()
  10. }
  11. // TwoFactorCacheKey returns key used for cache two factor passcode.
  12. // e.g. TwoFactor_1_012664
  13. func (u *User) TwoFactorCacheKey(passcode string) string {
  14. return "TwoFactor_" + u.IDStr() + "_" + passcode
  15. }