Skip to content

Commit ec2d366

Browse files
committed
Patch #10
1 parent 7b4d274 commit ec2d366

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/login/pages/Login.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ export default function Login(
149149
</div>
150150
</div>
151151
)}
152-
{social.providers.length !== 0 && <h5>{msgStr("selfCredentials")}</h5>}
152+
{social?.providers?.length !== 0 && (
153+
<h5>{msgStr("selfCredentials")}</h5>
154+
)}
153155
<div className={classes.inputs}>
154156
{(() => {
155157
const label = !realm.loginWithEmailAllowed
@@ -161,9 +163,10 @@ export default function Login(
161163
const autoCompleteHelper: typeof label =
162164
label === "usernameOrEmail" ? "username" : label;
163165

164-
const usernameInputType = realm.registrationEmailAsUsername
165-
? "email"
166-
: "text"
166+
const usernameInputType =
167+
realm.registrationEmailAsUsername
168+
? "email"
169+
: "text";
167170

168171
return (
169172
<Input
@@ -180,7 +183,14 @@ export default function Login(
180183
"autoComplete": "off"
181184
})
182185
}}
183-
label={usernameInputType === "email" ? msgStr("email") : msgStr("emailOrUsername")}
186+
label={(() => {
187+
switch (usernameInputType) {
188+
case "email":
189+
return msgStr("email");
190+
case "text":
191+
return msgStr("username");
192+
}
193+
})()}
184194
hintText={msgStr("email hint")}
185195
/>
186196
);

0 commit comments

Comments
 (0)