feat: 分离密码重置和修改密码功能

- 密码重置:用户忘记密码时通过邮箱/短信验证(需开启开关)
- 修改密码:已登录用户通过旧密码修改(固定功能,无需配置)
- 添加 EnablePasswordReset 开关控制密码重置功能
- PasswordResetMethod 只支持 email/sms 两种验证方式
- 添加短信配置管理功能
- 移除独立的应用邮箱设置页面
This commit is contained in:
2026-05-03 01:18:27 +08:00
parent 00067b1bff
commit 1f7dfd17a7
31 changed files with 2435 additions and 1477 deletions
+45 -41
View File
@@ -67,43 +67,45 @@ func GetApplicationDisabledStatus(appID uint) bool {
type ApplicationWithStatus struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
Name string `json:"name"`
Description string `json:"description"`
AppKey string `json:"app_key"`
IconURL string `json:"icon_url"`
Status string `json:"status"`
BillingType string `json:"billing_type"`
LoginPolicy string `json:"login_policy"`
MaxDevices int `json:"max_devices"`
MultiOpen bool `json:"multi_open"`
MultiOpenMode string `json:"multi_open_mode"`
EnableTrial bool `json:"enable_trial"`
TrialDays int `json:"trial_days"`
EnableFreePeriod bool `json:"enable_free_period"`
FreePeriodType string `json:"free_period_type"`
FreePeriodStart string `json:"free_period_start"`
FreePeriodEnd string `json:"free_period_end"`
FreePeriodWeekdays string `json:"free_period_weekdays"`
FreePeriodStartTime string `json:"free_period_start_time"`
FreePeriodEndTime string `json:"free_period_end_time"`
HeartbeatInterval int `json:"heartbeat_interval"`
HeartbeatTimeout int `json:"heartbeat_timeout"`
MaxAttempts int `json:"max_attempts"`
LockDuration int `json:"lock_duration"`
DeductionMode string `json:"deduction_mode"`
DeductionType string `json:"deduction_type"`
DeductionInterval int `json:"deduction_interval"`
DeductionUnit string `json:"deduction_unit"`
DeductionAmount float64 `json:"deduction_amount"`
AllowRegister bool `json:"allow_register"`
RegisterMethods string `json:"register_methods"`
EnableEmailVerify bool `json:"enable_email_verify"`
RequireEmailVerify bool `json:"require_email_verify"`
EnablePasswordReset bool `json:"enable_password_reset"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
DisabledByPackage bool `json:"disabled_by_package"`
UserID uint `json:"user_id"`
Name string `json:"name"`
Description string `json:"description"`
AppKey string `json:"app_key"`
IconURL string `json:"icon_url"`
Status string `json:"status"`
BillingType string `json:"billing_type"`
LoginPolicy string `json:"login_policy"`
MaxDevices int `json:"max_devices"`
MultiOpenMode string `json:"multi_open_mode"`
EnableTrial bool `json:"enable_trial"`
TrialDays int `json:"trial_days"`
EnableFreePeriod bool `json:"enable_free_period"`
FreePeriodType string `json:"free_period_type"`
FreePeriodStart string `json:"free_period_start"`
FreePeriodEnd string `json:"free_period_end"`
FreePeriodWeekdays string `json:"free_period_weekdays"`
FreePeriodStartTime string `json:"free_period_start_time"`
FreePeriodEndTime string `json:"free_period_end_time"`
HeartbeatInterval int `json:"heartbeat_interval"`
HeartbeatTimeout int `json:"heartbeat_timeout"`
MaxAttempts int `json:"max_attempts"`
LockDuration int `json:"lock_duration"`
DeductionMode string `json:"deduction_mode"`
DeductionType string `json:"deduction_type"`
DeductionInterval int `json:"deduction_interval"`
DeductionUnit string `json:"deduction_unit"`
DeductionAmount float64 `json:"deduction_amount"`
AllowRegister bool `json:"allow_register"`
EnableLoginVerify bool `json:"enable_login_verify"`
EnableRegisterVerify bool `json:"enable_register_verify"`
VerifyMethod string `json:"verify_method"`
EnablePasswordReset bool `json:"enable_password_reset"`
PasswordResetMethod string `json:"password_reset_method"`
PasswordResetEmailID *uint `json:"password_reset_email_id"`
PasswordResetSmsID *uint `json:"password_reset_sms_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
DisabledByPackage bool `json:"disabled_by_package"`
}
func GetApplicationsWithDisabledStatus(userID uint) ([]ApplicationWithStatus, error) {
@@ -130,7 +132,6 @@ func GetApplicationsWithDisabledStatus(userID uint) ([]ApplicationWithStatus, er
BillingType: app.BillingType,
LoginPolicy: app.LoginPolicy,
MaxDevices: app.MaxDevices,
MultiOpen: app.MultiOpen,
MultiOpenMode: app.MultiOpenMode,
EnableTrial: app.EnableTrial,
TrialDays: app.TrialDays,
@@ -151,10 +152,13 @@ func GetApplicationsWithDisabledStatus(userID uint) ([]ApplicationWithStatus, er
DeductionUnit: app.DeductionUnit,
DeductionAmount: app.DeductionAmount,
AllowRegister: app.AllowRegister,
RegisterMethods: app.RegisterMethods,
EnableEmailVerify: app.EnableEmailVerify,
RequireEmailVerify: app.RequireEmailVerify,
EnableLoginVerify: app.EnableLoginVerify,
EnableRegisterVerify: app.EnableRegisterVerify,
VerifyMethod: app.VerifyMethod,
EnablePasswordReset: app.EnablePasswordReset,
PasswordResetMethod: app.PasswordResetMethod,
PasswordResetEmailID: app.PasswordResetEmailID,
PasswordResetSmsID: app.PasswordResetSmsID,
CreatedAt: app.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
UpdatedAt: app.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
}