This commit is contained in:
eson
2023-08-30 18:44:41 +08:00
parent b2c68a9dc1
commit 0135a17ef8
4 changed files with 34 additions and 24 deletions

View File

@@ -100,9 +100,10 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
switch token.OperateType {
case auth.OpTypeRegister:
if time.Since(token.CreateAt) >= 24*time.Hour {
return resp.SetStatus(basic.CodeOAuthConfirmationTimeoutErr)
if time.Since(token.CreateAt) > 30*time.Minute {
return resp.SetStatusWithMessage(basic.CodeOAuthConfirmationTimeoutErr, "Verification links expire after 30 minute.")
}
logx.Info(token.Platform)
switch token.Platform {
case string(auth.PLATFORM_GOOGLE):
@@ -110,7 +111,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
user, err := l.svcCtx.AllModels.FsUser.RegisterByGoogleOAuth(l.ctx, token)
if err != nil {
logx.Error(err, token.TraceId)
return resp.SetStatus(basic.CodeDbSqlErr)
return resp.SetStatus(basic.CodeDbSqlErr, err.Error())
}
err = FinishRegister(l.svcCtx, user, token)
@@ -148,39 +149,44 @@ func (l *UserEmailConfirmationLogic) AfterLogic(w http.ResponseWriter, r *http.R
successHtml := `<!DOCTYPE html>
<html>
<head>
<title>注册成功</title>
<title>Registration Successful</title>
<style>
body {
font-family: sans-serif;
font-size: 16px;
}
h1 {
font-size: 24px;
color: red;
}
@media screen and (max-width: 480px) {
body {
font-family: sans-serif;
font-size: 16px;
font-size: 14px;
}
h1 {
font-size: 24px;
color: red;
}
@media screen and (max-width: 480px) {
body {
font-size: 14px;
}
h1 {
font-size: 18px;
}
font-size: 18px;
}
}
</style>
</head>
<body>
<h1>恭喜!您的注册成功。</h1>
<p>感谢您在我们网站进行注册。您的账号已经激活。</p>
<h1>Congratulations! Your registration is successful.</h1>
<p>您现在可以使用您的邮箱地址和密码登录我们的网站,享受完整的服务和功能。</p>
<p>Thank you for registering on our website. Your account has been activated.</p>
<p>再次感谢您的信任和支持。如果您有任何问题,请随时联系我们。</p>
<p>You can now login using your email address and password to enjoy full services and features on our website.</p>
<p>Thanks again for your trust and support. If you have any questions, please feel free to contact us.</p>
<p>We wish you a pleasant experience!</p>
<p>祝您使用愉快!</p>
</body>
</html>`
w.Write([]byte(successHtml))
@@ -191,7 +197,7 @@ func (l *UserEmailConfirmationLogic) AfterLogic(w http.ResponseWriter, r *http.R
<!DOCTYPE html>
<html>
<head>
<title>注册失败</title>
<title>Failed to register</title>
<style>
body {
font-family: sans-serif;