Update misc.go
This commit is contained in:
parent
3e81d8af45
commit
3ae8737402
@ -77,6 +77,27 @@ func SendEmailVerification(c *gin.Context) {
|
|||||||
"message": "无效的参数",
|
"message": "无效的参数",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
// 允许的邮箱后缀列表
|
||||||
|
allowedEmailSuffixes := []string{
|
||||||
|
"@163.com", "@qq.com", "@126.com", "@139.com", "@sina.com",
|
||||||
|
"@sohu.com", "@gmail.com", "@189.cn", "@yeah.net", "@foxmail.com",
|
||||||
|
}
|
||||||
|
|
||||||
|
validSuffix := false
|
||||||
|
for _, suffix := range allowedEmailSuffixes {
|
||||||
|
if strings.HasSuffix(email, suffix) {
|
||||||
|
validSuffix = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validSuffix {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"message": "不支持此邮箱",
|
||||||
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if model.IsEmailAlreadyTaken(email) {
|
if model.IsEmailAlreadyTaken(email) {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
Loading…
Reference in New Issue
Block a user