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
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. RetryInterval int
  14. MaxRetryTimes int
  15. }
  16. var (
  17. // Phone verify info
  18. PhoneService *Phone
  19. )
  20. func newPhoneService() {
  21. sec := Cfg.Section("phone")
  22. // Check phone setting.
  23. if !sec.Key("ENABLED").MustBool() {
  24. PhoneService = &Phone{
  25. Enabled: sec.Key("ENABLED").MustBool(),
  26. }
  27. return
  28. }
  29. PhoneService = &Phone{
  30. Enabled: sec.Key("ENABLED").MustBool(),
  31. VerifyCodeLength: sec.Key("VERIFY_CODE_LEN").MustInt(6),
  32. AccessKeyId: sec.Key("AccessKeyId").String(),
  33. AccessKeySecret: sec.Key("AccessKeySecret").String(),
  34. SignName: sec.Key("SignName").String(),
  35. TemplateCode: sec.Key("TemplateCode").String(),
  36. CodeTimeout: sec.Key("CODE_TIMEOUT").MustInt(60 * 5),
  37. RetryInterval: sec.Key("RETRY_INTERVAL").MustInt(60 * 2),
  38. MaxRetryTimes: sec.Key("MAX_RETRY").MustInt(5),
  39. }
  40. log.Info("Phone Service Enabled")
  41. }