Skip to content

Commit

Permalink
Patch #10
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed May 23, 2024
1 parent 7b4d274 commit ec2d366
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/login/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ export default function Login(
</div>
</div>
)}
{social.providers.length !== 0 && <h5>{msgStr("selfCredentials")}</h5>}
{social?.providers?.length !== 0 && (
<h5>{msgStr("selfCredentials")}</h5>
)}
<div className={classes.inputs}>
{(() => {
const label = !realm.loginWithEmailAllowed
Expand All @@ -161,9 +163,10 @@ export default function Login(
const autoCompleteHelper: typeof label =
label === "usernameOrEmail" ? "username" : label;

const usernameInputType = realm.registrationEmailAsUsername
? "email"
: "text"
const usernameInputType =
realm.registrationEmailAsUsername
? "email"
: "text";

return (
<Input
Expand All @@ -180,7 +183,14 @@ export default function Login(
"autoComplete": "off"
})
}}
label={usernameInputType === "email" ? msgStr("email") : msgStr("emailOrUsername")}
label={(() => {
switch (usernameInputType) {
case "email":
return msgStr("email");
case "text":
return msgStr("username");
}
})()}
hintText={msgStr("email hint")}
/>
);
Expand Down

0 comments on commit ec2d366

Please sign in to comment.