diff --git a/internal/config/config.go b/internal/config/config.go index 9f65611..813f603 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -101,11 +101,12 @@ type EmailConfig struct { EnableNotify bool `yaml:"enable_notify"` EnableDomainSuffix bool `yaml:"enable_domain_suffix"` DomainSuffixList string `yaml:"domain_suffix_list"` - VerifyEmailTemplate string `yaml:"verify_email_template"` - VerifyEmailTemplates map[string]string `yaml:"verify_email_templates"` - ExpirationEmailTemplate string `yaml:"expiration_email_template"` - MaintenanceEmailTemplate string `yaml:"maintenance_email_template"` - TrafficExceedEmailTemplate string `yaml:"traffic_exceed_email_template"` + VerifyEmailTemplate string `yaml:"verify_email_template"` + VerifyEmailTemplates map[string]string `yaml:"verify_email_templates"` + ExpirationEmailTemplate string `yaml:"expiration_email_template"` + MaintenanceEmailTemplate string `yaml:"maintenance_email_template"` + TrafficExceedEmailTemplate string `yaml:"traffic_exceed_email_template"` + DeleteAccountEmailTemplate string `yaml:"delete_account_email_template"` } type MobileConfig struct { diff --git a/internal/logic/admin/user/getFamilyDetailLogic.go b/internal/logic/admin/user/getFamilyDetailLogic.go index b58e112..d4db6d4 100644 --- a/internal/logic/admin/user/getFamilyDetailLogic.go +++ b/internal/logic/admin/user/getFamilyDetailLogic.go @@ -82,7 +82,7 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest memberItem := types.FamilyMemberItem{ UserId: member.UserId, Identifier: identifier, - DeviceNo: deviceNoMap[member.UserId], + DeviceID: deviceNoMap[member.UserId], Role: member.Role, RoleName: mapFamilyRoleName(member.Role), Status: member.Status, diff --git a/internal/logic/admin/user/getUserDetailLogic.go b/internal/logic/admin/user/getUserDetailLogic.go index 61d8b1e..e3b186c 100644 --- a/internal/logic/admin/user/getUserDetailLogic.go +++ b/internal/logic/admin/user/getUserDetailLogic.go @@ -37,7 +37,7 @@ func (l *GetUserDetailLogic) GetUserDetail(req *types.GetDetailRequest) (*types. tool.DeepCopy(&resp, userInfo) for i, d := range userInfo.UserDevices { if i < len(resp.UserDevices) { - resp.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id) + resp.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id) } } if referCode := strings.TrimSpace(resp.ReferCode); referCode != "" { diff --git a/internal/logic/admin/user/getUserListLogic.go b/internal/logic/admin/user/getUserListLogic.go index d484a5d..ea1efd2 100644 --- a/internal/logic/admin/user/getUserListLogic.go +++ b/internal/logic/admin/user/getUserListLogic.go @@ -163,10 +163,10 @@ func (l *GetUserListLogic) GetUserList(req *types.GetUserListRequest) (*types.Ge } u.AuthMethods = authMethods - // 填充 DeviceNo + // 填充 DeviceID for i, d := range item.UserDevices { if i < len(u.UserDevices) { - u.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id) + u.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id) } } diff --git a/internal/logic/admin/user/getUserSubscribeDevicesLogic.go b/internal/logic/admin/user/getUserSubscribeDevicesLogic.go index 007d61a..679f5d2 100644 --- a/internal/logic/admin/user/getUserSubscribeDevicesLogic.go +++ b/internal/logic/admin/user/getUserSubscribeDevicesLogic.go @@ -36,7 +36,7 @@ func (l *GetUserSubscribeDevicesLogic) GetUserSubscribeDevices(req *types.GetUse tool.DeepCopy(&userRespList, list) for i, d := range list { if i < len(userRespList) { - userRespList[i].DeviceNo = tool.DeviceIdToHash(d.Id) + userRespList[i].DeviceID = tool.DeviceIdToHash(d.Id) } } return &types.GetUserSubscribeDevicesResponse{ diff --git a/internal/logic/common/sendEmailCodeLogic.go b/internal/logic/common/sendEmailCodeLogic.go index 0170b99..06adfe9 100644 --- a/internal/logic/common/sendEmailCodeLogic.go +++ b/internal/logic/common/sendEmailCodeLogic.go @@ -89,7 +89,11 @@ func (l *SendEmailCodeLogic) SendEmailCode(req *types.SendCodeRequest) (resp *ty // Generate verification code code := random.Key(6, 0) scene := constant.ParseVerifyType(req.Type).String() - taskPayload.Type = queue.EmailTypeVerify + if scene == constant.DeleteAccount.String() { + taskPayload.Type = queue.EmailTypeDeleteAccount + } else { + taskPayload.Type = queue.EmailTypeVerify + } taskPayload.Scene = scene taskPayload.Email = req.Email taskPayload.Subject = "Verification code" diff --git a/internal/logic/public/user/getDeviceListLogic.go b/internal/logic/public/user/getDeviceListLogic.go index b1ea792..a1da1fb 100644 --- a/internal/logic/public/user/getDeviceListLogic.go +++ b/internal/logic/public/user/getDeviceListLogic.go @@ -38,7 +38,7 @@ func (l *GetDeviceListLogic) GetDeviceList() (resp *types.GetDeviceListResponse, tool.DeepCopy(&userRespList, list) for i, d := range list { if i < len(userRespList) { - userRespList[i].DeviceNo = tool.DeviceIdToHash(d.Id) + userRespList[i].DeviceID = tool.DeviceIdToHash(d.Id) } } resp = &types.GetDeviceListResponse{ diff --git a/internal/logic/public/user/queryUserInfoLogic.go b/internal/logic/public/user/queryUserInfoLogic.go index 7ddf548..21afb39 100644 --- a/internal/logic/public/user/queryUserInfoLogic.go +++ b/internal/logic/public/user/queryUserInfoLogic.go @@ -47,7 +47,7 @@ func (l *QueryUserInfoLogic) QueryUserInfo() (resp *types.User, err error) { tool.DeepCopy(resp, u) for i, d := range u.UserDevices { if i < len(resp.UserDevices) { - resp.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id) + resp.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id) } } // refer_code 为空时自动生成 diff --git a/internal/model/auth/auth.go b/internal/model/auth/auth.go index be40d92..6e70c95 100644 --- a/internal/model/auth/auth.go +++ b/internal/model/auth/auth.go @@ -113,17 +113,18 @@ func (l *TelegramAuthConfig) Unmarshal(data string) error { } type EmailAuthConfig struct { - Platform string `json:"platform"` - PlatformConfig interface{} `json:"platform_config"` - EnableVerify bool `json:"enable_verify"` - EnableNotify bool `json:"enable_notify"` - EnableDomainSuffix bool `json:"enable_domain_suffix"` - DomainSuffixList string `json:"domain_suffix_list"` - VerifyEmailTemplate string `json:"verify_email_template"` - VerifyEmailTemplates map[string]string `json:"verify_email_templates"` - ExpirationEmailTemplate string `json:"expiration_email_template"` - MaintenanceEmailTemplate string `json:"maintenance_email_template"` - TrafficExceedEmailTemplate string `json:"traffic_exceed_email_template"` + Platform string `json:"platform"` + PlatformConfig interface{} `json:"platform_config"` + EnableVerify bool `json:"enable_verify"` + EnableNotify bool `json:"enable_notify"` + EnableDomainSuffix bool `json:"enable_domain_suffix"` + DomainSuffixList string `json:"domain_suffix_list"` + VerifyEmailTemplate string `json:"verify_email_template"` + VerifyEmailTemplates map[string]string `json:"verify_email_templates"` + ExpirationEmailTemplate string `json:"expiration_email_template"` + MaintenanceEmailTemplate string `json:"maintenance_email_template"` + TrafficExceedEmailTemplate string `json:"traffic_exceed_email_template"` + DeleteAccountEmailTemplate string `json:"delete_account_email_template"` } func (l *EmailAuthConfig) Marshal() string { @@ -136,6 +137,9 @@ func (l *EmailAuthConfig) Marshal() string { if l.TrafficExceedEmailTemplate == "" { l.TrafficExceedEmailTemplate = email.DefaultTrafficExceedEmailTemplate } + if l.DeleteAccountEmailTemplate == "" { + l.DeleteAccountEmailTemplate = email.DefaultDeleteAccountEmailTemplate + } if l.VerifyEmailTemplate == "" { l.VerifyEmailTemplate = email.DefaultEmailVerifyTemplate } @@ -145,17 +149,18 @@ func (l *EmailAuthConfig) Marshal() string { bytes, err := json.Marshal(l) if err != nil { config := &EmailAuthConfig{ - Platform: "smtp", - PlatformConfig: new(SMTPConfig), - EnableVerify: true, - EnableNotify: true, - EnableDomainSuffix: false, - DomainSuffixList: "", - VerifyEmailTemplate: email.DefaultEmailVerifyTemplate, - VerifyEmailTemplates: map[string]string{}, - ExpirationEmailTemplate: email.DefaultExpirationEmailTemplate, - MaintenanceEmailTemplate: email.DefaultMaintenanceEmailTemplate, - TrafficExceedEmailTemplate: email.DefaultTrafficExceedEmailTemplate, + Platform: "smtp", + PlatformConfig: new(SMTPConfig), + EnableVerify: true, + EnableNotify: true, + EnableDomainSuffix: false, + DomainSuffixList: "", + VerifyEmailTemplate: email.DefaultEmailVerifyTemplate, + VerifyEmailTemplates: map[string]string{}, + ExpirationEmailTemplate: email.DefaultExpirationEmailTemplate, + MaintenanceEmailTemplate: email.DefaultMaintenanceEmailTemplate, + TrafficExceedEmailTemplate: email.DefaultTrafficExceedEmailTemplate, + DeleteAccountEmailTemplate: email.DefaultDeleteAccountEmailTemplate, } bytes, _ = json.Marshal(config) @@ -189,6 +194,9 @@ func (l *EmailAuthConfig) Unmarshal(data string) { if l.VerifyEmailTemplates == nil { l.VerifyEmailTemplates = map[string]string{} } + if l.DeleteAccountEmailTemplate == "" { + l.DeleteAccountEmailTemplate = email.DefaultDeleteAccountEmailTemplate + } } // SMTPConfig Email SMTP configuration diff --git a/internal/types/types.go b/internal/types/types.go index aa88d6e..8fe6a96 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -682,7 +682,7 @@ type FamilyDetail struct { type FamilyMemberItem struct { UserId int64 `json:"user_id"` Identifier string `json:"identifier"` - DeviceNo string `json:"device_no"` + DeviceID string `json:"device_id"` Role uint8 `json:"role"` RoleName string `json:"role_name"` Status uint8 `json:"status"` @@ -2957,7 +2957,7 @@ type UserDevice struct { Id int64 `json:"id"` Ip string `json:"ip"` Identifier string `json:"identifier"` - DeviceNo string `json:"device_no"` + DeviceID string `json:"device_id"` UserAgent string `json:"user_agent"` Online bool `json:"online"` Enabled bool `json:"enabled"` diff --git a/pkg/email/template.go b/pkg/email/template.go index 00121a0..7026e87 100644 --- a/pkg/email/template.go +++ b/pkg/email/template.go @@ -27,12 +27,12 @@ const (
亲爱的用户, - 我们收到了你在{{.SiteName}}的注销请求 + 你正在进行{{.SiteName}}账户相关操作 请在系统提示时输入以下验证码:
@@ -300,4 +300,42 @@ const (