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
eb828f63
authored
Jan 15, 2026
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: the login method cannot be displayed under the aff link.
parent
5c1d43fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
18 deletions
+32
-18
web/src/components/auth/LoginForm.jsx
+15
-7
web/src/components/auth/RegisterForm.jsx
+17
-11
No files found.
web/src/components/auth/LoginForm.jsx
View file @
eb828f63
...
...
@@ -17,9 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import
React
,
{
useContext
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
React
,
{
useContext
,
useEffect
,
use
Memo
,
use
Ref
,
useState
}
from
'react'
;
import
{
Link
,
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
UserContext
}
from
'../../context/User'
;
import
{
StatusContext
}
from
'../../context/Status'
;
import
{
API
,
getLogo
,
...
...
@@ -73,6 +74,7 @@ const LoginForm = () => {
const
[
searchParams
,
setSearchParams
]
=
useSearchParams
();
const
[
submitted
,
setSubmitted
]
=
useState
(
false
);
const
[
userState
,
userDispatch
]
=
useContext
(
UserContext
);
const
[
statusState
]
=
useContext
(
StatusContext
);
const
[
turnstileEnabled
,
setTurnstileEnabled
]
=
useState
(
false
);
const
[
turnstileSiteKey
,
setTurnstileSiteKey
]
=
useState
(
''
);
const
[
turnstileToken
,
setTurnstileToken
]
=
useState
(
''
);
...
...
@@ -108,20 +110,26 @@ const LoginForm = () => {
localStorage
.
setItem
(
'aff'
,
affCode
);
}
const
[
status
]
=
useState
(()
=>
{
const
status
=
useMemo
(()
=>
{
if
(
statusState
?.
status
)
return
statusState
.
status
;
const
savedStatus
=
localStorage
.
getItem
(
'status'
);
return
savedStatus
?
JSON
.
parse
(
savedStatus
)
:
{};
});
if
(
!
savedStatus
)
return
{};
try
{
return
JSON
.
parse
(
savedStatus
)
||
{};
}
catch
(
err
)
{
return
{};
}
},
[
statusState
?.
status
]);
useEffect
(()
=>
{
if
(
status
.
turnstile_check
)
{
if
(
status
?
.
turnstile_check
)
{
setTurnstileEnabled
(
true
);
setTurnstileSiteKey
(
status
.
turnstile_site_key
);
}
// 从 status 获取用户协议和隐私政策的启用状态
setHasUserAgreement
(
status
.
user_agreement_enabled
||
false
);
setHasPrivacyPolicy
(
status
.
privacy_policy_enabled
||
false
);
setHasUserAgreement
(
status
?
.
user_agreement_enabled
||
false
);
setHasPrivacyPolicy
(
status
?
.
privacy_policy_enabled
||
false
);
},
[
status
]);
useEffect
(()
=>
{
...
...
web/src/components/auth/RegisterForm.jsx
View file @
eb828f63
...
...
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import
React
,
{
useContext
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
React
,
{
useContext
,
useEffect
,
use
Memo
,
use
Ref
,
useState
}
from
'react'
;
import
{
Link
,
useNavigate
}
from
'react-router-dom'
;
import
{
API
,
...
...
@@ -51,6 +51,7 @@ import LinuxDoIcon from '../common/logo/LinuxDoIcon';
import
WeChatIcon
from
'../common/logo/WeChatIcon'
;
import
TelegramLoginButton
from
'react-telegram-login/src'
;
import
{
UserContext
}
from
'../../context/User'
;
import
{
StatusContext
}
from
'../../context/Status'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
{
SiDiscord
}
from
'react-icons/si'
;
...
...
@@ -72,6 +73,7 @@ const RegisterForm = () => {
});
const
{
username
,
password
,
password2
}
=
inputs
;
const
[
userState
,
userDispatch
]
=
useContext
(
UserContext
);
const
[
statusState
]
=
useContext
(
StatusContext
);
const
[
turnstileEnabled
,
setTurnstileEnabled
]
=
useState
(
false
);
const
[
turnstileSiteKey
,
setTurnstileSiteKey
]
=
useState
(
''
);
const
[
turnstileToken
,
setTurnstileToken
]
=
useState
(
''
);
...
...
@@ -106,25 +108,29 @@ const RegisterForm = () => {
localStorage
.
setItem
(
'aff'
,
affCode
);
}
const
[
status
]
=
useState
(()
=>
{
const
status
=
useMemo
(()
=>
{
if
(
statusState
?.
status
)
return
statusState
.
status
;
const
savedStatus
=
localStorage
.
getItem
(
'status'
);
return
savedStatus
?
JSON
.
parse
(
savedStatus
)
:
{};
});
if
(
!
savedStatus
)
return
{};
try
{
return
JSON
.
parse
(
savedStatus
)
||
{};
}
catch
(
err
)
{
return
{};
}
},
[
statusState
?.
status
]);
const
[
showEmailVerification
,
setShowEmailVerification
]
=
useState
(()
=>
{
return
status
.
email_verification
??
false
;
});
const
[
showEmailVerification
,
setShowEmailVerification
]
=
useState
(
false
);
useEffect
(()
=>
{
setShowEmailVerification
(
status
.
email_verification
);
if
(
status
.
turnstile_check
)
{
setShowEmailVerification
(
!!
status
?
.
email_verification
);
if
(
status
?
.
turnstile_check
)
{
setTurnstileEnabled
(
true
);
setTurnstileSiteKey
(
status
.
turnstile_site_key
);
}
// 从 status 获取用户协议和隐私政策的启用状态
setHasUserAgreement
(
status
.
user_agreement_enabled
||
false
);
setHasPrivacyPolicy
(
status
.
privacy_policy_enabled
||
false
);
setHasUserAgreement
(
status
?
.
user_agreement_enabled
||
false
);
setHasPrivacyPolicy
(
status
?
.
privacy_policy_enabled
||
false
);
},
[
status
]);
useEffect
(()
=>
{
...
...
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