Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
232251fa
authored
Apr 02, 2024
by
Ghostz
Committed by
GitHub
Apr 02, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update misc.go
parent
63597081
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
controller/misc.go
+15
-5
No files found.
controller/misc.go
View file @
232251fa
...
...
@@ -120,18 +120,28 @@ func SendEmailVerification(c *gin.Context) {
})
return
}
if
common
.
EmailDomainRestrictionEnabled
{
if
config
.
EmailDomainRestrictionEnabled
{
parts
:=
strings
.
Split
(
email
,
"@"
)
localPart
:=
parts
[
0
]
domainPart
:=
parts
[
1
]
containsSpecialSymbols
:=
strings
.
Contains
(
localPart
,
"+"
)
||
strings
.
Count
(
localPart
,
"."
)
>
1
allowed
:=
false
for
_
,
domain
:=
range
co
mmon
.
EmailDomainWhitelist
{
if
strings
.
HasSuffix
(
email
,
"@"
+
domain
)
{
for
_
,
domain
:=
range
co
nfig
.
EmailDomainWhitelist
{
if
domainPart
==
domain
{
allowed
=
true
break
}
}
if
!
allowed
{
if
allowed
&&
!
containsSpecialSymbols
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"message"
:
"Your email address is allowed."
,
})
}
else
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
false
,
"message"
:
"
管理员启用了邮箱域名白名单,您的邮箱地址的域名不在白名单中
"
,
"message"
:
"
The administrator has enabled the email domain name whitelist, and your email address is not allowed due to special symbols or it's not in the whitelist.
"
,
})
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment