MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / SignIn

Function SignIn

apps/web/ui/Auth/index.tsx:63–209  ·  view source on GitHub ↗
({
  csrfToken,
  callbackUrl,
  state,
  withLayout = true,
  showSignUp,
  onSignIn,
  redirectFn,
  origin,
  ...props
}: {
  csrfToken?: string;
  error?: string;
  email?: string;
  callbackUrl?: string;
  state?: string;
  withLayout?: boolean;
  showSignUp?: (mode: SignInMode) => void;
  onSignIn?: () => void;
  sso?: string;
  redirectFn?(url: string): void;
  origin?: string;
  mode: SignInMode;
  setMode?(props: SignInMode): void;
})

Source from the content-addressed store, hash-verified

61}
62
63function SignIn({
64 csrfToken,
65 callbackUrl,
66 state,
67 withLayout = true,
68 showSignUp,
69 onSignIn,
70 redirectFn,
71 origin,
72 ...props
73}: {
74 csrfToken?: string;
75 error?: string;
76 email?: string;
77 callbackUrl?: string;
78 state?: string;
79 withLayout?: boolean;
80 showSignUp?: (mode: SignInMode) => void;
81 onSignIn?: () => void;
82 sso?: string;
83 redirectFn?(url: string): void;
84 origin?: string;
85 mode: SignInMode;
86 setMode?(props: SignInMode): void;
87}) {
88 const [mode, setMode] = useState<SignInMode>(props.mode || 'magic');
89 const [email, setEmail] = useState(props.email);
90 const [error, setError] = useState(props.error);
91 const [loading, setLoading] = useState(false);
92
93 const Layout = withLayout
94 ? CardLayout
95 : (props: any) => <>{props.children}</>;
96
97 const redirectUrl = prepareUrl(callbackUrl);
98
99 return (
100 <Layout header="Sign In">
101 <Error error={error} />
102
103 <form
104 onSubmit={(e) =>
105 onSignInSubmit({
106 setError,
107 setLoading,
108 callbackUrl: redirectUrl,
109 onSignIn,
110 state,
111 ...props,
112 })(e, mode)
113 }
114 >
115 <input name="csrfToken" type="hidden" defaultValue={csrfToken} />
116
117 <EmailField
118 placeholder="Email address"
119 id="email"
120 required

Callers

nothing calls this directly

Calls 3

onSignInSubmitFunction · 0.90
qsFunction · 0.90
prepareUrlFunction · 0.85

Tested by

no test coverage detected