You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

phone.go 1.1 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package setting
  2. import (
  3. "code.gitea.io/gitea/modules/log"
  4. )
  5. type Phone struct {
  6. Enabled bool
  7. VerifyCodeLength int
  8. AccessKeyId string
  9. AccessKeySecret string
  10. SignName string
  11. TemplateCode string
  12. CodeTimeout int
  13. ManualTimeout int
  14. RetryInterval int
  15. MaxRetryTimes int
  16. }
  17. var (
  18. // Phone verify info
  19. PhoneService *Phone
  20. )
  21. func newPhoneService() {
  22. sec := Cfg.Section("phone")
  23. // Check phone setting.
  24. if !sec.Key("ENABLED").MustBool() {
  25. PhoneService = &Phone{
  26. Enabled: sec.Key("ENABLED").MustBool(),
  27. }
  28. return
  29. }
  30. PhoneService = &Phone{
  31. Enabled: sec.Key("ENABLED").MustBool(),
  32. VerifyCodeLength: sec.Key("VERIFY_CODE_LEN").MustInt(6),
  33. AccessKeyId: sec.Key("AccessKeyId").String(),
  34. AccessKeySecret: sec.Key("AccessKeySecret").String(),
  35. SignName: sec.Key("SignName").String(),
  36. TemplateCode: sec.Key("TemplateCode").String(),
  37. CodeTimeout: sec.Key("CODE_TIMEOUT").MustInt(60 * 5),
  38. RetryInterval: sec.Key("RETRY_INTERVAL").MustInt(60 * 2),
  39. MaxRetryTimes: sec.Key("MAX_RETRY").MustInt(5),
  40. }
  41. log.Info("Phone Service Enabled")
  42. }