fix: disable email sending while registration was locked
This commit is contained in:
parent
ec88c0c240
commit
d807299776
@ -3,10 +3,11 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"one-api/common"
|
"one-api/common"
|
||||||
"one-api/model"
|
"one-api/model"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetStatus(c *gin.Context) {
|
func GetStatus(c *gin.Context) {
|
||||||
@ -85,6 +86,13 @@ func SendEmailVerification(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if !common.RegisterEnabled {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"message": "管理员关闭了新用户注册",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
code := common.GenerateVerificationCode(6)
|
code := common.GenerateVerificationCode(6)
|
||||||
common.RegisterVerificationCodeWithKey(email, code, common.EmailVerificationPurpose)
|
common.RegisterVerificationCodeWithKey(email, code, common.EmailVerificationPurpose)
|
||||||
subject := fmt.Sprintf("%s邮箱验证邮件", common.SystemName)
|
subject := fmt.Sprintf("%s邮箱验证邮件", common.SystemName)
|
||||||
|
Loading…
Reference in New Issue
Block a user