Fix bug in getDefaultLoginMethod()

This commit is contained in:
Yang Luo 2024-01-13 12:13:09 +08:00
parent f5395f15f9
commit 8968396ae5

View File

@ -201,7 +201,7 @@ class LoginPage extends React.Component {
}
getDefaultLoginMethod(application) {
if (application?.signinMethods.length > 0) {
if (application?.signinMethods?.length > 0) {
switch (application?.signinMethods[0].name) {
case "Password": return "password";
case "Verification code": {
@ -937,7 +937,7 @@ class LoginPage extends React.Component {
[generateItemKey("LDAP", "None"), {label: i18next.t("login:LDAP"), key: "ldap"}],
]);
application?.signinMethods.forEach((signinMethod) => {
application?.signinMethods?.forEach((signinMethod) => {
const item = itemsMap.get(generateItemKey(signinMethod.name, signinMethod.rule));
if (item) {
const label = signinMethod.name === signinMethod.displayName ? item.label : signinMethod.displayName;