mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-02 20:00:26 +08:00
修复otp相关编译问题
This commit is contained in:
@@ -2,7 +2,6 @@ package users
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils/otputils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
@@ -58,15 +57,11 @@ func (this *OtpQrcodeAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
uiConfig, err := configloaders.LoadUserUIConfig()
|
||||
productName, err := this.findProductName()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var productName = uiConfig.ProductName
|
||||
if len(productName) == 0 {
|
||||
productName = "GoEdge用户"
|
||||
}
|
||||
var url = gotp.NewDefaultTOTP(secret).ProvisioningUri(user.Username, productName)
|
||||
data, err := qrcode.Encode(otputils.FixIssuer(url), qrcode.Medium, 256)
|
||||
if err != nil {
|
||||
|
||||
18
internal/web/actions/default/users/otpQrcode_ext.go
Normal file
18
internal/web/actions/default/users/otpQrcode_ext.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
//go:build !plus
|
||||
|
||||
package users
|
||||
|
||||
import "github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
|
||||
func (this *OtpQrcodeAction) findProductName() (string, error) {
|
||||
uiConfig, err := configloaders.LoadAdminUIConfig()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
var productName = uiConfig.ProductName
|
||||
if len(productName) == 0 {
|
||||
productName = "GoEdge用户"
|
||||
}
|
||||
return productName, nil
|
||||
}
|
||||
Reference in New Issue
Block a user