Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(passport): User able to disconnect the wallet and still sign in using the earlier triggered MetaMask notification #2393

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/passport/app/routes/authenticate/$clientId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const InnerComponent = ({
signData,
navigate,
authnQueryParams,
loading,
loading: loading || transitionState !== 'idle',
walletConnectCallback: async (address) => {
if (loading) return
// fetch nonce and kickoff sign flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,57 @@ export function ConnectButton({

{isConnected && (
<Popover>
{({ open }) => (
<>
<Popover.Button className="h-full px-2 lg:px-3.5 flex justify-center items-center rounded-r-md bg-white dark:bg-[#374151] dark:border-gray-600 dark:hover:bg-gray-600 text-[#1f2937] shadow-sm border-l hover:bg-gray-100 dark:focus:bg-gray-600 focus:bg-white focus:ring-inset focus:ring-2 focus:ring-skin-primary">
{!open && (
<HiChevronDown className="w-5 h-5 text-skin-primary" />
)}
{open && (
<HiChevronUp className="w-5 h-5 text-skin-primary" />
)}
</Popover.Button>
<Popover.Panel className="absolute top-16 left-0 right-0 z-10 bg-white dark:bg-[#374151] dark:border-gray-600 dark:hover:bg-gray-600 rounded-md shadow-md">
<button
className="w-full px-[17px] py-5"
onClick={() => {
disconnect()
}}
{({ open }) => {
const disabled = isConnecting || isSigning || isLoading
return (
<>
<Popover.Button
disabled={disabled}
className={`h-full px-2 lg:px-3.5 flex justify-center
items-center rounded-r-md bg-white dark:bg-[#374151]
dark:border-gray-600 dark:hover:bg-gray-600
shadow-sm border-l hover:bg-gray-100
dark:focus:bg-gray-600 focus:bg-white
focus:ring-inset focus:ring-2 focus:ring-skin-primary`}
>
<Text
size="sm"
weight="normal"
className="text-red-600 dark:text-red-400 text-start"
>{`Disconnect ${ensName ?? truncatedAddress}`}</Text>
</button>
</Popover.Panel>
</>
)}
{!open && (
<HiChevronDown
className={`w-5 h-5 ${
disabled
? 'text-gray-100 dark:text-gray-800'
: 'text-skin-primary'
}`}
/>
)}
{open && (
<HiChevronUp
className={`w-5 h-5 ${
disabled
? 'text-gray-100 dark:text-gray-800'
: 'text-skin-primary'
}`}
/>
)}
</Popover.Button>
<Popover.Panel className="absolute top-16 left-0 right-0 z-10 bg-white dark:bg-[#374151] dark:border-gray-600 dark:hover:bg-gray-600 rounded-md shadow-md">
<button
className="w-full px-[17px] py-5"
onClick={() => {
disconnect()
}}
>
<Text
size="sm"
weight="normal"
className="text-red-600 dark:text-red-400 text-start"
>{`Disconnect ${
ensName ?? truncatedAddress
}`}</Text>
</button>
</Popover.Panel>
</>
)
}}
</Popover>
)}
</div>
Expand Down
Loading