MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / SignInPage

Function SignInPage

packages/ui/src/views/auth/signIn.jsx:40–348  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38// ==============================|| SignInPage ||============================== //
39
40const SignInPage = () => {
41 const theme = useTheme()
42 useSelector((state) => state.customization)
43 useNotifier()
44 const { isEnterpriseLicensed, isCloud, isOpenSource } = useConfig()
45
46 const usernameInput = {
47 label: 'Username',
48 name: 'username',
49 type: 'email',
50 placeholder: 'user@company.com'
51 }
52 const passwordInput = {
53 label: 'Password',
54 name: 'password',
55 type: 'password',
56 placeholder: '********',
57 enablePasswordToggle: true
58 }
59 const [usernameVal, setUsernameVal] = useState('')
60 const [passwordVal, setPasswordVal] = useState('')
61 const [configuredSsoProviders, setConfiguredSsoProviders] = useState([])
62 const [authError, setAuthError] = useState(undefined)
63 const [loading, setLoading] = useState(false)
64 const [showResendButton, setShowResendButton] = useState(false)
65 const [successMessage, setSuccessMessage] = useState('')
66
67 const { authRateLimitError, setAuthRateLimitError } = useError()
68
69 const loginApi = useApi(authApi.login)
70 const ssoLoginApi = useApi(ssoApi.ssoLogin)
71 const getDefaultProvidersApi = useApi(loginMethodApi.getDefaultLoginMethods)
72 const navigate = useNavigate()
73 const location = useLocation()
74 const resendVerificationApi = useApi(accountApi.resendVerificationEmail)
75
76 const doLogin = (event) => {
77 event.preventDefault()
78 setAuthRateLimitError(null)
79 setLoading(true)
80 const body = {
81 email: usernameVal,
82 password: passwordVal
83 }
84 loginApi.request(body)
85 }
86
87 useEffect(() => {
88 if (loginApi.error) {
89 setLoading(false)
90 if (loginApi.error.response.status === 401 && loginApi.error.response.data.redirectUrl) {
91 window.location.href = loginApi.error.response.data.data.redirectUrl
92 } else {
93 setAuthError(loginApi.error.response.data.message)
94 }
95 }
96 }, [loginApi.error])
97

Callers

nothing calls this directly

Calls 6

useConfigFunction · 0.90
useErrorFunction · 0.90
useNotifierFunction · 0.85
signInWithSSOFunction · 0.70
parseMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected