Skip to content

Commit

Permalink
Not render login iframe if its localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Mar 5, 2024
1 parent e399937 commit 911da8b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/auth/AuthorizationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getCurrentUrlOrigin } from 'src/utils/url'
import urlJoin from 'src/utils/url-join'
import { NotificationsBell, useNotifCounterContext } from '../activity/NotifCounter'
import { NewPostButtonInTopMenu } from '../posts/NewPostButtonInTopMenu'
import { MyAccountPopup } from '../profiles/address-views'
import { MyAccountPopup } from '../profile-selector/MyAccountMenu'
import { isServerSide } from '../utils'
import { useMyAddress } from './MyAccountsContext'

Expand Down
35 changes: 20 additions & 15 deletions src/components/profile-selector/MyAccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export const AccountMenu: React.FunctionComponent<AddressProps> = ({ address, ow
}
}, [])

const origin = getCurrentUrlOrigin()
const isDevMode = origin.includes('localhost')

return (
<span
onClick={() => {
Expand All @@ -101,21 +104,23 @@ export const AccountMenu: React.FunctionComponent<AddressProps> = ({ address, ow
className='DfCurrentAddress icon CursorPointer'
>
<Avatar address={address} avatar={owner?.content?.image} asLink={false} size={30} noMargin />
<iframe
ref={iframeRef}
src={`${getCurrentUrlOrigin()}/c/widget/profile`}
style={{
opacity: isOpenProfileModal ? 1 : 0,
pointerEvents: isOpenProfileModal ? 'auto' : 'none',
transition: 'opacity 0.3s ease-in-out',
colorScheme: 'none',
background: 'transparent',
position: 'fixed',
inset: 0,
width: '100%',
height: '100%',
}}
/>
{!isDevMode && (
<iframe
ref={iframeRef}
src={`${getCurrentUrlOrigin()}/c/widget/profile`}
style={{
opacity: isOpenProfileModal ? 1 : 0,
pointerEvents: isOpenProfileModal ? 'auto' : 'none',
transition: 'opacity 0.3s ease-in-out',
colorScheme: 'none',
background: 'transparent',
position: 'fixed',
inset: 0,
width: '100%',
height: '100%',
}}
/>
)}
</span>
)
}
Expand Down

0 comments on commit 911da8b

Please sign in to comment.