Skip to content

Commit 3977454

Browse files
committed
修复otp相关编译问题
1 parent 783b81b commit 3977454

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

internal/web/actions/default/users/otpQrcode.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package users
22

33
import (
44
"encoding/json"
5-
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
65
"github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils"
76
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
87
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
@@ -58,15 +57,11 @@ func (this *OtpQrcodeAction) RunGet(params struct {
5857
return
5958
}
6059

61-
uiConfig, err := configloaders.LoadUserUIConfig()
60+
productName, err := this.findProductName()
6261
if err != nil {
6362
this.ErrorPage(err)
6463
return
6564
}
66-
var productName = uiConfig.ProductName
67-
if len(productName) == 0 {
68-
productName = "GoEdge用户"
69-
}
7065
var url = gotp.NewDefaultTOTP(secret).ProvisioningUri(user.Username, productName)
7166
data, err := qrcode.Encode(otputils.FixIssuer(url), qrcode.Medium, 256)
7267
if err != nil {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2024 GoEdge CDN [email protected]. All rights reserved. Official site: https://goedge.cn .
2+
//go:build !plus
3+
4+
package users
5+
6+
import "github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
7+
8+
func (this *OtpQrcodeAction) findProductName() (string, error) {
9+
uiConfig, err := configloaders.LoadAdminUIConfig()
10+
if err != nil {
11+
return "", err
12+
}
13+
var productName = uiConfig.ProductName
14+
if len(productName) == 0 {
15+
productName = "GoEdge用户"
16+
}
17+
return productName, nil
18+
}

0 commit comments

Comments
 (0)