Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming 2023-08-30 18:51:31 +08:00
commit 0a6192427f
4 changed files with 34 additions and 24 deletions

1
go.mod
View File

@ -27,6 +27,7 @@ require (
require (
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/474420502/execute v0.2.2 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/VictoriaMetrics/metrics v1.18.1 // indirect

2
go.sum
View File

@ -35,6 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/474420502/execute v0.2.2 h1:Hzzb/HFa/urRvi3xWe+p/DnJgRyxXFVyEBEXbbITy/E=
github.com/474420502/execute v0.2.2/go.mod h1:wkKeKBIXYp7T844eU1YS2nPvFj8lra4VRcQYnWyXej4=
github.com/474420502/passer v0.0.1 h1:ZWnt7hpFzsYDV7LHSEyLvLUvW5mRxrnDmgFdIl17q3w=
github.com/474420502/passer v0.0.1/go.mod h1:MmnnrF9d51sPkFzdRq2pQtxQKqyjburVM1LjMbOCezE=
github.com/474420502/random v0.4.1 h1:HUUyLXRWMijVb7CJoEC16f0aFQOW25Lkr80Mut6PoKU=

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;

1
utils/check/limit.go Normal file
View File

@ -0,0 +1 @@
package check