Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
e1a28848
Commit
e1a28848
authored
Apr 20, 2026
by
IanShaw027
Browse files
fix: clarify wechat existing account binding
parent
7fdede57
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/views/auth/WechatCallbackView.vue
View file @
e1a28848
...
@@ -116,11 +116,16 @@
...
@@ -116,11 +116,16 @@
{{
t
(
'
auth.alreadyHaveAccount
'
)
}}
{{
t
(
'
auth.alreadyHaveAccount
'
)
}}
<
/p
>
<
/p
>
<
p
class
=
"
text-xs text-gray-500 dark:text-dark-400
"
>
<
p
class
=
"
text-xs text-gray-500 dark:text-dark-400
"
>
Sign
in
to
an
existing
account
,
then
bind
this
WeChat
identity
to
it
.
{{
hasCurrentAuthToken
?
'
Bind this WeChat identity to the account currently signed in on this browser.
'
:
'
Sign in to an existing account, then bind this WeChat identity to it.
'
}}
<
/p
>
<
/p
>
<
/div
>
<
/div
>
<
input
<
input
v
-
if
=
"
!hasCurrentAuthToken
"
v
-
model
=
"
existingAccountEmail
"
v
-
model
=
"
existingAccountEmail
"
data
-
testid
=
"
existing-account-email
"
data
-
testid
=
"
existing-account-email
"
type
=
"
email
"
type
=
"
email
"
...
@@ -136,7 +141,7 @@
...
@@ -136,7 +141,7 @@
:
disabled
=
"
isSubmitting
"
:
disabled
=
"
isSubmitting
"
@
click
=
"
handleExistingAccountBinding
"
@
click
=
"
handleExistingAccountBinding
"
>
>
{{
t
(
'
auth.signIn
'
)
}}
{{
hasCurrentAuthToken
?
'
Bind current account
'
:
t
(
'
auth.signIn
'
)
}}
<
/button
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -353,6 +358,7 @@ const bindSuccessMessage = t('profile.authBindings.bindSuccess')
...
@@ -353,6 +358,7 @@ const bindSuccessMessage = t('profile.authBindings.bindSuccess')
const
providerName
=
'
WeChat
'
const
providerName
=
'
WeChat
'
const
needsCreateAccount
=
computed
(()
=>
pendingAccountAction
.
value
===
'
create_account
'
)
const
needsCreateAccount
=
computed
(()
=>
pendingAccountAction
.
value
===
'
create_account
'
)
const
needsBindLogin
=
computed
(()
=>
pendingAccountAction
.
value
===
'
bind_login
'
)
const
needsBindLogin
=
computed
(()
=>
pendingAccountAction
.
value
===
'
bind_login
'
)
const
hasCurrentAuthToken
=
computed
(()
=>
Boolean
(
getAuthToken
()))
type
PendingWeChatCompletion
=
PendingOAuthExchangeResponse
&
{
type
PendingWeChatCompletion
=
PendingOAuthExchangeResponse
&
{
step
?:
string
step
?:
string
...
...
frontend/src/views/auth/__tests__/WechatCallbackView.spec.ts
View file @
e1a28848
...
@@ -345,6 +345,35 @@ describe('WechatCallbackView', () => {
...
@@ -345,6 +345,35 @@ describe('WechatCallbackView', () => {
expect
(
replaceMock
.
mock
.
calls
[
0
]?.[
0
]).
toContain
(
'
mode%3Dopen
'
)
expect
(
replaceMock
.
mock
.
calls
[
0
]?.[
0
]).
toContain
(
'
mode%3Dopen
'
)
})
})
it
(
'
binds directly to the current signed-in account during invitation flow
'
,
async
()
=>
{
exchangePendingOAuthCompletionMock
.
mockResolvedValue
({
error
:
'
invitation_required
'
,
redirect
:
'
/usage
'
,
})
getAuthTokenMock
.
mockReturnValue
(
'
current-auth-token
'
)
const
wrapper
=
mount
(
WechatCallbackView
,
{
global
:
{
stubs
:
{
AuthLayout
:
{
template
:
'
<div><slot /></div>
'
},
Icon
:
true
,
RouterLink
:
{
template
:
'
<a><slot /></a>
'
},
transition
:
false
,
},
},
})
await
flushPromises
()
expect
(
wrapper
.
find
(
'
[data-testid="existing-account-email"]
'
).
exists
()).
toBe
(
false
)
await
wrapper
.
get
(
'
[data-testid="existing-account-submit"]
'
).
trigger
(
'
click
'
)
expect
(
prepareOAuthBindAccessTokenCookieMock
).
toHaveBeenCalledTimes
(
1
)
expect
(
locationState
.
current
.
href
).
toContain
(
'
intent=bind_current_user
'
)
expect
(
locationState
.
current
.
href
).
toContain
(
'
redirect=%2Fusage
'
)
expect
(
locationState
.
current
.
href
).
toContain
(
'
mode=open
'
)
})
it
(
'
collects email for pending oauth account creation and submits adoption decisions
'
,
async
()
=>
{
it
(
'
collects email for pending oauth account creation and submits adoption decisions
'
,
async
()
=>
{
exchangePendingOAuthCompletionMock
.
mockResolvedValue
({
exchangePendingOAuthCompletionMock
.
mockResolvedValue
({
error
:
'
email_required
'
,
error
:
'
email_required
'
,
...
...
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