@@ -11,9 +11,11 @@ import { getCookie } from 'lib/api'
1111import { BridgePage } from 'lib/components/BridgePage/BridgePage'
1212import { SSOEnforcedLoginButton , SocialLoginButtons } from 'lib/components/SocialLoginButton/SocialLoginButton'
1313import { supportLogic } from 'lib/components/Support/supportLogic'
14+ import { usePrevious } from 'lib/hooks/usePrevious'
1415import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
1516import { LemonField } from 'lib/lemon-ui/LemonField'
1617import { Link } from 'lib/lemon-ui/Link'
18+ import { isEmail } from 'lib/utils'
1719import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
1820import { SceneExport } from 'scenes/sceneTypes'
1921import { urls } from 'scenes/urls'
@@ -86,6 +88,7 @@ export function Login(): JSX.Element {
8688 const wasPasswordHiddenRef = useRef ( isPasswordHidden )
8789
8890 const lastLoginMethod = getCookie ( LAST_LOGIN_METHOD_COOKIE ) as LoginMethod
91+ const prevEmail = usePrevious ( login . email )
8992
9093 useEffect ( ( ) => {
9194 const wasPasswordHidden = wasPasswordHiddenRef . current
@@ -99,6 +102,16 @@ export function Login(): JSX.Element {
99102 }
100103 } , [ isPasswordHidden , resetLogin ] )
101104
105+ // Trigger precheck for password manager autofill/paste (detected by large character delta)
106+ useEffect ( ( ) => {
107+ const charDelta = login . email . length - ( prevEmail ?. length ?? 0 )
108+ const isAutofill = charDelta > 1
109+
110+ if ( isAutofill && isEmail ( login . email , { requireTLD : true } ) && precheckResponse . status === 'pending' ) {
111+ precheck ( { email : login . email } )
112+ }
113+ } , [ login . email , prevEmail , precheckResponse . status , precheck ] )
114+
102115 return (
103116 < BridgePage
104117 view = "login"
0 commit comments