feat: add SMS verification registration with UniSMS provider

- Add phone field to user model with index and helper methods
- Implement SMS provider interface with UniSMS (合一短信) implementation
- Add SMS verification code sending endpoint with rate limiting (1/60s)
- Support SMS registration in Register() (mutually exclusive with email)
- Add SMS configuration to admin settings (provider, keys, signature, template)
- Display phone number in admin user list contact column
- Add i18n translations for all SMS-related messages (zh-CN, en, zh-TW)
- Add Claude Code skills: sync-upstream, migrate-server
- Update CLAUDE.md with git conventions and deployment guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
nosqli
2026-03-06 23:57:15 +08:00
parent 4a4cf0a0df
commit 835cd8e74b
26 changed files with 815 additions and 17 deletions

View File

@@ -62,6 +62,12 @@ func InitOptionMap() {
common.OptionMap["SMTPAccount"] = ""
common.OptionMap["SMTPToken"] = ""
common.OptionMap["SMTPSSLEnabled"] = strconv.FormatBool(common.SMTPSSLEnabled)
common.OptionMap["SMSVerificationEnabled"] = strconv.FormatBool(common.SMSVerificationEnabled)
common.OptionMap["SMSProvider"] = common.SMSProvider
common.OptionMap["SMSAccessKeyId"] = common.SMSAccessKeyId
common.OptionMap["SMSAccessKeySecret"] = common.SMSAccessKeySecret
common.OptionMap["SMSSignName"] = common.SMSSignName
common.OptionMap["SMSTemplateCode"] = common.SMSTemplateCode
common.OptionMap["Notice"] = ""
common.OptionMap["About"] = ""
common.OptionMap["HomePageContent"] = ""
@@ -292,6 +298,8 @@ func updateOptionMap(key string, value string) (err error) {
setting.StopOnSensitiveEnabled = boolValue
case "SMTPSSLEnabled":
common.SMTPSSLEnabled = boolValue
case "SMSVerificationEnabled":
common.SMSVerificationEnabled = boolValue
case "WorkerAllowHttpImageRequestEnabled":
system_setting.WorkerAllowHttpImageRequestEnabled = boolValue
case "DefaultUseAutoGroup":
@@ -314,6 +322,16 @@ func updateOptionMap(key string, value string) (err error) {
common.SMTPFrom = value
case "SMTPToken":
common.SMTPToken = value
case "SMSProvider":
common.SMSProvider = value
case "SMSAccessKeyId":
common.SMSAccessKeyId = value
case "SMSAccessKeySecret":
common.SMSAccessKeySecret = value
case "SMSSignName":
common.SMSSignName = value
case "SMSTemplateCode":
common.SMSTemplateCode = value
case "ServerAddress":
system_setting.ServerAddress = value
case "WorkerUrl":