This commit is contained in:
eson 2023-09-06 12:29:34 +08:00
parent 6bbaac287b
commit 67230a58bf
3 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,27 @@
Subject: Please confirm your {{ .CompanyName }} account
MIME-version: 1.0
Content-Type: text/html; charset="UTF-8"
From: "Fusen Support"
<html>
<body>
<p>Dear <span style="color: red;">{{.UserName}}</span>,</p>
<p>Thank you for choosing {{ .CompanyName }}. To complete the account setup process, please click the button below to confirm your email address:</p>
<a href="{{ .ConfirmationLink }}" target="_blank" style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block; font-weight: bold;">Confirm Email: {{ .UserName }}</a>
<p>Confirming your email ensures your account is properly secured. This also allows you to access member-only tools and content.</p>
<p>If you did not initiate this request or have any questions, please disregard this email. Your account will not be activated.</p>
Regards,
<p><span>{{.SenderName}}</span><br>
<span>{{.SenderTitle}}</span><br>
<span>{{.CompanyName}}</span></p>
</body>
</html>

View File

@ -128,7 +128,7 @@ func (u *FsUserModel) RegisterByGoogleOAuth(ctx context.Context, token *auth.Reg
// 如果已经存在,把谷歌id 加入到用户信息里 // 如果已经存在,把谷歌id 加入到用户信息里
user.GoogleId = &googleId user.GoogleId = &googleId
return tx.Model(&FsUser{}).Update("google_id", user).Error return tx.Model(&FsUser{}).Where("id = ?", user.Id).Update("google_id", user).Error
}) })
if err != nil { if err != nil {

View File

@ -72,10 +72,17 @@ func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegist
return resp.SetStatus(basic.CodeOAuthRegisterTokenErr) return resp.SetStatus(basic.CodeOAuthRegisterTokenErr)
} }
var tplsel string = "email_register.tpl"
if token.Platform == auth.PLATFORM_FUSEN {
tplsel = "email_register.tpl"
} else {
tplsel = "email_register_oauth2.tpl"
}
userName := token.Extend["first_name"].(string) + " " + token.Extend["last_name"].(string) userName := token.Extend["first_name"].(string) + " " + token.Extend["last_name"].(string)
// 进入发送邮箱的系统 // 进入发送邮箱的系统
EmailManager.EmailTasks <- &EmailFormat{ EmailManager.EmailTasks <- &EmailFormat{
TemplateName: "email_register.tpl", TemplateName: tplsel,
UniqueKey: "register-" + req.Email, UniqueKey: "register-" + req.Email,
TargetEmail: req.Email, TargetEmail: req.Email,
CompanyName: "fusen", CompanyName: "fusen",