@@ -9,6 +9,7 @@ import { OAuthSignInForm } from "./OAuthSignInForm"
9
9
import { BuiltInAuthFormValues } from "./SignInForm.types"
10
10
import Button from "@material-ui/core/Button"
11
11
import EmailIcon from "@material-ui/icons/EmailOutlined"
12
+ import { AlertBanner } from "components/AlertBanner/AlertBanner"
12
13
13
14
export enum LoginErrors {
14
15
AUTH_ERROR = "authError" ,
@@ -94,6 +95,7 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
94
95
const oAuthEnabled = Boolean (
95
96
authMethods ?. github . enabled || authMethods ?. oidc . enabled ,
96
97
)
98
+ const passwordEnabled = authMethods ?. password . enabled ?? true
97
99
98
100
// Hide password auth by default if any OAuth method is enabled
99
101
const [ showPasswordAuth , setShowPasswordAuth ] = useState ( ! oAuthEnabled )
@@ -108,15 +110,15 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
108
110
{ loginPageTranslation . t ( "signInTo" ) } { " " }
109
111
< strong > { commonTranslation . t ( "coder" ) } </ strong >
110
112
</ h1 >
111
- < Maybe condition = { showPasswordAuth } >
113
+ < Maybe condition = { passwordEnabled && showPasswordAuth } >
112
114
< PasswordSignInForm
113
115
loginErrors = { loginErrors }
114
116
onSubmit = { onSubmit }
115
117
initialTouched = { initialTouched }
116
118
isLoading = { isLoading }
117
119
/>
118
120
</ Maybe >
119
- < Maybe condition = { showPasswordAuth && oAuthEnabled } >
121
+ < Maybe condition = { passwordEnabled && showPasswordAuth && oAuthEnabled } >
120
122
< div className = { styles . divider } >
121
123
< div className = { styles . dividerLine } />
122
124
< div className = { styles . dividerLabel } > Or</ div >
@@ -131,7 +133,14 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
131
133
/>
132
134
</ Maybe >
133
135
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 } >
135
144
< div className = { styles . divider } >
136
145
< div className = { styles . dividerLine } />
137
146
< div className = { styles . dividerLabel } > Or</ div >
0 commit comments