@@ -9,6 +9,7 @@ import { OAuthSignInForm } from "./OAuthSignInForm"
99import { BuiltInAuthFormValues } from "./SignInForm.types"
1010import Button from "@material-ui/core/Button"
1111import EmailIcon from "@material-ui/icons/EmailOutlined"
12+ import { AlertBanner } from "components/AlertBanner/AlertBanner"
1213
1314export enum LoginErrors {
1415 AUTH_ERROR = "authError" ,
@@ -94,6 +95,7 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
9495 const oAuthEnabled = Boolean (
9596 authMethods ?. github . enabled || authMethods ?. oidc . enabled ,
9697 )
98+ const passwordEnabled = authMethods ?. password . enabled ?? true
9799
98100 // Hide password auth by default if any OAuth method is enabled
99101 const [ showPasswordAuth , setShowPasswordAuth ] = useState ( ! oAuthEnabled )
@@ -108,15 +110,15 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
108110 { loginPageTranslation . t ( "signInTo" ) } { " " }
109111 < strong > { commonTranslation . t ( "coder" ) } </ strong >
110112 </ h1 >
111- < Maybe condition = { showPasswordAuth } >
113+ < Maybe condition = { passwordEnabled && showPasswordAuth } >
112114 < PasswordSignInForm
113115 loginErrors = { loginErrors }
114116 onSubmit = { onSubmit }
115117 initialTouched = { initialTouched }
116118 isLoading = { isLoading }
117119 />
118120 </ Maybe >
119- < Maybe condition = { showPasswordAuth && oAuthEnabled } >
121+ < Maybe condition = { passwordEnabled && showPasswordAuth && oAuthEnabled } >
120122 < div className = { styles . divider } >
121123 < div className = { styles . dividerLine } />
122124 < div className = { styles . dividerLabel } > Or</ div >
@@ -131,7 +133,14 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
131133 />
132134 </ Maybe >
133135
134- < Maybe condition = { ! showPasswordAuth } >
136+ < Maybe condition = { ! passwordEnabled && ! oAuthEnabled } >
137+ < AlertBanner
138+ severity = "error"
139+ text = "No authentication methods configured!"
140+ />
141+ </ Maybe >
142+
143+ < Maybe condition = { passwordEnabled && ! showPasswordAuth } >
135144 < div className = { styles . divider } >
136145 < div className = { styles . dividerLine } />
137146 < div className = { styles . dividerLabel } > Or</ div >
0 commit comments