更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -9,7 +9,6 @@ import (
|
||||
"server/models"
|
||||
)
|
||||
|
||||
// ListSystemEmails 返回从 yz_platform_normal_setting 组装的邮箱配置(切片,通常仅一条)
|
||||
func ListSystemEmails() ([]models.SystemEmail, error) {
|
||||
enabledStr := models.GetPlatformSettingValue("email_enabled", "0")
|
||||
fromAddress := models.GetPlatformSettingValue("email_from_address", "")
|
||||
@@ -46,7 +45,6 @@ func ListSystemEmails() ([]models.SystemEmail, error) {
|
||||
return []models.SystemEmail{row}, nil
|
||||
}
|
||||
|
||||
// UpsertFirstSystemEmail 将邮箱配置保存到 yz_platform_normal_setting 表中
|
||||
func UpsertFirstSystemEmail(fromAddress string, fromName *string, host string, port uint, password string, encryption string, timeout uint, status int8, remark *string) error {
|
||||
if encryption == "" {
|
||||
encryption = "ssl"
|
||||
@@ -85,7 +83,6 @@ func UpsertFirstSystemEmail(fromAddress string, fromName *string, host string, p
|
||||
{"email_timeout", "邮件发送超时时间", strconv.FormatUint(uint64(timeout), 10), ""},
|
||||
}
|
||||
|
||||
// 如果传入了新密码,或者目前还没有保存过密码,才更新密码
|
||||
if strings.TrimSpace(password) != "" {
|
||||
settings = append(settings, struct {
|
||||
code string
|
||||
@@ -94,7 +91,6 @@ func UpsertFirstSystemEmail(fromAddress string, fromName *string, host string, p
|
||||
remark string
|
||||
}{"email_password", "邮件授权码/密码", strings.TrimSpace(password), ""})
|
||||
} else {
|
||||
// 校验:如果完全没有配置过密码,必须填写密码
|
||||
existingPass := models.GetPlatformSettingValue("email_password", "")
|
||||
if existingPass == "" {
|
||||
return fmt.Errorf("首次保存必须填写授权码/密码")
|
||||
|
||||
Reference in new issue
Block a user