Skip to content

Commit

Permalink
Rm password check
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed May 27, 2024
1 parent ccc4008 commit ae4aa89
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 60 deletions.
3 changes: 0 additions & 3 deletions src/components/common/PageLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import SideDrawer from './SideDrawer'
import { useIsSidebarRoute } from '@/hooks/useIsSidebarRoute'
import { TxModalContext } from '@/components/tx-flow'
import BatchSidebar from '@/components/batch/BatchSidebar'
import SocialLoginDeprecation from '@/components/common/SocialLoginDeprecation'

const PageLayout = ({ pathname, children }: { pathname: string; children: ReactElement }): ReactElement => {
const [isSidebarRoute, isAnimated] = useIsSidebarRoute(pathname)
Expand All @@ -36,8 +35,6 @@ const PageLayout = ({ pathname, children }: { pathname: string; children: ReactE
})}
>
<div className={css.content}>
<SocialLoginDeprecation />

<SafeLoadingError>{children}</SafeLoadingError>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/SocialSigner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const SocialSigner = ({ socialWalletService, wallet, onLogin, onRequirePa
}}
/>
<Box display="flex" flexDirection="row" alignItems="center" gap={1}>
<SvgIcon component={GoogleLogo} inheritViewBox fontSize="medium" /> Continue with Google
<SvgIcon component={GoogleLogo} inheritViewBox fontSize="medium" /> Login with Google
</Box>
</Button>
</Track>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ const ExportMPCAccountModal = ({ onClose, open }: { onClose: () => void; open: b
<DialogContent>
<form onSubmit={handleSubmit(onSubmit)}>
<Box display="flex" flexDirection="column" gap={2} alignItems="flex-start" sx={{ width: '100%' }}>
<Typography>For security reasons you have to enter your password to reveal your account key.</Typography>
<Typography>
{' '}
Never disclose your keys or seed phrase to anyone. If someone gains access to them, they will have access
to your account.
</Typography>

{exportedKey ? (
<Box display="flex" flexDirection="row" alignItems="center" gap={1} width="100%">
Expand All @@ -103,21 +107,8 @@ const ExportMPCAccountModal = ({ onClose, open }: { onClose: () => void; open: b
{...register(ExportFieldNames.pk)}
/>
</Box>
) : (
<>
<TextField
placeholder="Password"
label="Password"
type="password"
fullWidth
error={!!formState.errors[ExportFieldNames.password]}
helperText={formState.errors[ExportFieldNames.password]?.message}
{...register(ExportFieldNames.password, {
required: true,
})}
/>
</>
)}
) : null}

{error && <ErrorMessage className={css.modalError}>{error}</ErrorMessage>}

<Box
Expand Down
42 changes: 17 additions & 25 deletions src/components/settings/SecurityLogin/SocialSignerExport/index.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
import Track from '@/components/common/Track'
import { MPC_WALLET_EVENTS } from '@/services/analytics/events/mpcWallet'
import { Alert, Box, Button, Tooltip, Typography } from '@mui/material'
import { Box, Button, Typography } from '@mui/material'
import { useState } from 'react'
import ExportMPCAccountModal from '@/components/settings/SecurityLogin/SocialSignerExport/ExportMPCAccountModal'
import useSocialWallet from '@/hooks/wallets/mpc/useSocialWallet'

const SocialSignerExport = () => {
const [isModalOpen, setIsModalOpen] = useState(false)

const socialWalletService = useSocialWallet()

const isPasswordSet = socialWalletService?.isRecoveryPasswordSet() ?? false

return (
<>
<Box display="flex" flexDirection="column" gap={2} alignItems="flex-start">
<Typography>
Signers created via Google can be exported and imported to any non-custodial wallet outside of Safe.
</Typography>
<Alert severity="warning">
Never disclose your keys or seed phrase to anyone. If someone gains access to them, they have full access over
your social login signer.
</Alert>
<Typography>
Signers created via Google can be exported and imported to any non-custodial wallet outside of Safe.
</Typography>

<Box display="flex" mt={3} gap={2} alignItems="center">
<Track {...MPC_WALLET_EVENTS.REVEAL_PRIVATE_KEY}>
<Tooltip title={isPasswordSet ? '' : 'Private key export is only available if you set a recovery password'}>
<span>
<Button
color="primary"
variant="contained"
sx={{ pointerEvents: 'all !important' }}
disabled={isModalOpen || !isPasswordSet}
onClick={() => setIsModalOpen(true)}
>
Reveal private key
</Button>
</span>
</Tooltip>
<Button
color="primary"
variant="contained"
sx={{ pointerEvents: 'all !important' }}
disabled={!socialWalletService || isModalOpen}
onClick={() => setIsModalOpen(true)}
>
Reveal private key
</Button>
</Track>

{!socialWalletService && <Typography>Please login with your Google account first.</Typography>}
</Box>

<ExportMPCAccountModal onClose={() => setIsModalOpen(false)} open={isModalOpen} />
</>
)
Expand Down
17 changes: 2 additions & 15 deletions src/components/settings/SecurityLogin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
import { Box, Grid, Paper, Typography } from '@mui/material'
import SocialSignerMFA from './SocialSignerMFA'
import SocialSignerExport from './SocialSignerExport'

const SecurityLogin = () => {
return (
<Box display="flex" flexDirection="column" gap={2}>
<Paper sx={{ p: 4 }}>
<Grid container spacing={3}>
<Grid item lg={4} xs={12}>
<Typography variant="h4" fontWeight="bold" mb={1}>
Multi-factor Authentication
</Typography>
</Grid>

<Grid item xs>
<SocialSignerMFA />
</Grid>
</Grid>
</Paper>
<Paper sx={{ p: 4, mt: 2 }}>
<Grid container spacing={3}>
<Grid item lg={4} xs={12}>
<Typography variant="h4" fontWeight="bold" mb={1}>
Social login signer export
Google login export
</Typography>
</Grid>

<Grid item xs>
<SocialSignerExport />
</Grid>
Expand Down

0 comments on commit ae4aa89

Please sign in to comment.