@klauswuestefeld/jux-web 2024.12.6 → 2024.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jux-web.js +13 -14
- package/dist/login/login-page.d.ts +1 -1
- package/dist/login/session.d.ts +2 -2
- package/dist/login/unauthorized-magic-link-request-page.d.ts +1 -1
- package/dist/main.esm.js +13 -14
- package/dist/main.js +13 -14
- package/package.json +1 -1
package/dist/jux-web.js
CHANGED
|
@@ -14464,7 +14464,7 @@ var juxWeb = (function (exports) {
|
|
|
14464
14464
|
return result;
|
|
14465
14465
|
};
|
|
14466
14466
|
|
|
14467
|
-
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn) => {
|
|
14467
|
+
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn, failInfo) => {
|
|
14468
14468
|
const content = [];
|
|
14469
14469
|
const notSent = document.createElement('p');
|
|
14470
14470
|
notSent.id = 'magic-link-not-sent';
|
|
@@ -14476,7 +14476,7 @@ var juxWeb = (function (exports) {
|
|
|
14476
14476
|
email.style.marginBottom = '10px';
|
|
14477
14477
|
const info = document.createElement('p');
|
|
14478
14478
|
info.id = 'magic-link-fail-info';
|
|
14479
|
-
info.innerHTML = getTranslation(info.id);
|
|
14479
|
+
info.innerHTML = getTranslation(failInfo || info.id);
|
|
14480
14480
|
info.style.padding = '0 30px';
|
|
14481
14481
|
info.style.textAlign = 'center';
|
|
14482
14482
|
const back = document.createElement('a');
|
|
@@ -14556,7 +14556,7 @@ var juxWeb = (function (exports) {
|
|
|
14556
14556
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
14557
14557
|
getSSOAuthorizationEndpoint(onSuccess, onError);
|
|
14558
14558
|
};
|
|
14559
|
-
const initSession = (clientApp, supportedLoginTypes, onUserLogin, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
14559
|
+
const initSession = (clientApp, supportedLoginTypes, onUserLogin, onLoginError, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
14560
14560
|
// if (startNewDemo()) {
|
|
14561
14561
|
// initDemo(setBackendToken, onAuthentication);
|
|
14562
14562
|
// return;
|
|
@@ -14610,7 +14610,7 @@ var juxWeb = (function (exports) {
|
|
|
14610
14610
|
handleSSOLogin();
|
|
14611
14611
|
return;
|
|
14612
14612
|
}
|
|
14613
|
-
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, supportedLoginTypes));
|
|
14613
|
+
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypes));
|
|
14614
14614
|
// validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
|
|
14615
14615
|
// checkMixpanel(() => mixpanel.track('View Login Page'));
|
|
14616
14616
|
};
|
|
@@ -14652,7 +14652,7 @@ var juxWeb = (function (exports) {
|
|
|
14652
14652
|
authSignIn(onUserLogin);
|
|
14653
14653
|
}, onCookieError);
|
|
14654
14654
|
};
|
|
14655
|
-
const onAuthPasswordLogin = (credentials, onUserLogin, onReturn, clientApp, backgroundImg) => {
|
|
14655
|
+
const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg) => {
|
|
14656
14656
|
const { email } = credentials;
|
|
14657
14657
|
enableSignInLayout();
|
|
14658
14658
|
const onSuccess = (res) => {
|
|
@@ -14663,13 +14663,12 @@ var juxWeb = (function (exports) {
|
|
|
14663
14663
|
disableSignInLayout();
|
|
14664
14664
|
};
|
|
14665
14665
|
const onError = (err) => {
|
|
14666
|
-
console.error(err);
|
|
14667
|
-
reportError(err);
|
|
14668
14666
|
disableSignInLayout();
|
|
14667
|
+
onLoginError(err);
|
|
14669
14668
|
};
|
|
14670
14669
|
const onUnauthorized = () => {
|
|
14671
14670
|
disableSignInLayout();
|
|
14672
|
-
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn);
|
|
14671
|
+
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn, 'auth-password-fail-info');
|
|
14673
14672
|
const magicLinkEmail = page.querySelector('#magic-link-email');
|
|
14674
14673
|
magicLinkEmail.textContent = email;
|
|
14675
14674
|
displayPage(clientApp, page);
|
|
@@ -14865,7 +14864,7 @@ var juxWeb = (function (exports) {
|
|
|
14865
14864
|
result.append(label, input);
|
|
14866
14865
|
return result;
|
|
14867
14866
|
};
|
|
14868
|
-
const authPasswordForm = (clientApp, loginPage, onUserLogin, backgroundImg) => {
|
|
14867
|
+
const authPasswordForm = (clientApp, loginPage, onUserLogin, onLoginError, backgroundImg) => {
|
|
14869
14868
|
const result = document.createElement('form');
|
|
14870
14869
|
const emailRow = authPasswordRow('email', 'username');
|
|
14871
14870
|
const emailInput = emailRow.querySelector('input');
|
|
@@ -14878,7 +14877,7 @@ var juxWeb = (function (exports) {
|
|
|
14878
14877
|
passwordInput.type = passwordType;
|
|
14879
14878
|
});
|
|
14880
14879
|
passwordRow.appendChild(togglePasswordDisplayBtn);
|
|
14881
|
-
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onReturn, clientApp, backgroundImg);
|
|
14880
|
+
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg);
|
|
14882
14881
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
14883
14882
|
const button = loginButton('Login', handlePasswordLogin);
|
|
14884
14883
|
button.classList.add('auth-password');
|
|
@@ -14896,7 +14895,7 @@ var juxWeb = (function (exports) {
|
|
|
14896
14895
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
14897
14896
|
loginPage.appendChild(magicLinkModal(onUserLogin, onReturn, backgroundImage, loginPage, clientApp, loginTypes));
|
|
14898
14897
|
};
|
|
14899
|
-
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, loginTypes, backgroundImg) => {
|
|
14898
|
+
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg) => {
|
|
14900
14899
|
if (loginTypes.includes('Google')) {
|
|
14901
14900
|
section.appendChild(loginButton('Google', () => onGoogleSignIn(onUserLogin)));
|
|
14902
14901
|
}
|
|
@@ -14910,10 +14909,10 @@ var juxWeb = (function (exports) {
|
|
|
14910
14909
|
section.appendChild(loginButton('Email', () => onEmailLoginRequest(clientApp, loginPage, onUserLogin, backgroundImg, loginTypes)));
|
|
14911
14910
|
}
|
|
14912
14911
|
if (loginTypes.includes('auth-password')) {
|
|
14913
|
-
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, backgroundImg));
|
|
14912
|
+
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, onLoginError, backgroundImg));
|
|
14914
14913
|
}
|
|
14915
14914
|
};
|
|
14916
|
-
const loginPage = (clientApp, backgroundImg, onUserLogin, loginTypes) => {
|
|
14915
|
+
const loginPage = (clientApp, backgroundImg, onUserLogin, onLoginError, loginTypes) => {
|
|
14917
14916
|
const content = [];
|
|
14918
14917
|
const salutation = document.createElement('sign-in-salutation');
|
|
14919
14918
|
salutation.textContent = getTranslation('sign-in-salutation');
|
|
@@ -14924,7 +14923,7 @@ var juxWeb = (function (exports) {
|
|
|
14924
14923
|
content.push(salutation, explanation, msg);
|
|
14925
14924
|
const result = basePage('login-page', backgroundImg, content);
|
|
14926
14925
|
const section = result.querySelector('section');
|
|
14927
|
-
appendLoginTypes(result, section, clientApp, onUserLogin, loginTypes, backgroundImg);
|
|
14926
|
+
appendLoginTypes(result, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg);
|
|
14928
14927
|
return result;
|
|
14929
14928
|
};
|
|
14930
14929
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const loginPage: (clientApp: HTMLElement, backgroundImg: string, onUserLogin: any, loginTypes: string[]) => HTMLElement;
|
|
1
|
+
export declare const loginPage: (clientApp: HTMLElement, backgroundImg: string, onUserLogin: any, onLoginError: any, loginTypes: string[]) => HTMLElement;
|
package/dist/login/session.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const setBackendToken: (token: string) => void;
|
|
2
2
|
export declare const onTokenAcquired: (token: string, onUserLogin: any) => void;
|
|
3
|
-
export declare const initSession: (clientApp: HTMLElement, supportedLoginTypes: string[], onUserLogin: any, backgroundImage: string, fetchUserBackendUrl: any, magicLinkRequestEndpoint: string | null, magicLinkAuthEndpoint: string | null) => void;
|
|
3
|
+
export declare const initSession: (clientApp: HTMLElement, supportedLoginTypes: string[], onUserLogin: any, onLoginError: any, backgroundImage: string, fetchUserBackendUrl: any, magicLinkRequestEndpoint: string | null, magicLinkAuthEndpoint: string | null) => void;
|
|
4
4
|
export declare const onMicrosoftSignIn: (onUserLogin: any) => Promise<void>;
|
|
5
5
|
export declare const onGoogleSignIn: (onUserLogin: any) => void;
|
|
6
|
-
export declare const onAuthPasswordLogin: (credentials: any, onUserLogin: any, onReturn: any, clientApp: HTMLElement, backgroundImg: string) => void;
|
|
6
|
+
export declare const onAuthPasswordLogin: (credentials: any, onUserLogin: any, onLoginError: any, onReturn: any, clientApp: HTMLElement, backgroundImg: string) => void;
|
|
7
7
|
export declare const handleMagicLinkRequest: (token: string | null, onReturn: any, backgroundImage: string, currentPage: HTMLElement, clientBody: HTMLElement, email?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const unauthorizedMagicLinkRequestPage: (backgroundImg: string, onReturn: any) => HTMLElement;
|
|
1
|
+
export declare const unauthorizedMagicLinkRequestPage: (backgroundImg: string, onReturn: any, failInfo?: string) => HTMLElement;
|
package/dist/main.esm.js
CHANGED
|
@@ -949,7 +949,7 @@ const magicLinkRequestedPage = (backgroundImg, onReturn) => {
|
|
|
949
949
|
return result;
|
|
950
950
|
};
|
|
951
951
|
|
|
952
|
-
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn) => {
|
|
952
|
+
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn, failInfo) => {
|
|
953
953
|
const content = [];
|
|
954
954
|
const notSent = document.createElement('p');
|
|
955
955
|
notSent.id = 'magic-link-not-sent';
|
|
@@ -961,7 +961,7 @@ const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn) => {
|
|
|
961
961
|
email.style.marginBottom = '10px';
|
|
962
962
|
const info = document.createElement('p');
|
|
963
963
|
info.id = 'magic-link-fail-info';
|
|
964
|
-
info.innerHTML = getTranslation(info.id);
|
|
964
|
+
info.innerHTML = getTranslation(failInfo || info.id);
|
|
965
965
|
info.style.padding = '0 30px';
|
|
966
966
|
info.style.textAlign = 'center';
|
|
967
967
|
const back = document.createElement('a');
|
|
@@ -1041,7 +1041,7 @@ const handleSSOLogin = () => {
|
|
|
1041
1041
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
1042
1042
|
getSSOAuthorizationEndpoint(onSuccess, onError);
|
|
1043
1043
|
};
|
|
1044
|
-
const initSession = (clientApp, supportedLoginTypes, onUserLogin, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
1044
|
+
const initSession = (clientApp, supportedLoginTypes, onUserLogin, onLoginError, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
1045
1045
|
// if (startNewDemo()) {
|
|
1046
1046
|
// initDemo(setBackendToken, onAuthentication);
|
|
1047
1047
|
// return;
|
|
@@ -1095,7 +1095,7 @@ const initSession = (clientApp, supportedLoginTypes, onUserLogin, backgroundImag
|
|
|
1095
1095
|
handleSSOLogin();
|
|
1096
1096
|
return;
|
|
1097
1097
|
}
|
|
1098
|
-
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, supportedLoginTypes));
|
|
1098
|
+
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypes));
|
|
1099
1099
|
// validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
|
|
1100
1100
|
// checkMixpanel(() => mixpanel.track('View Login Page'));
|
|
1101
1101
|
};
|
|
@@ -1137,7 +1137,7 @@ const onGoogleSignIn = (onUserLogin) => {
|
|
|
1137
1137
|
authSignIn(onUserLogin);
|
|
1138
1138
|
}, onCookieError);
|
|
1139
1139
|
};
|
|
1140
|
-
const onAuthPasswordLogin = (credentials, onUserLogin, onReturn, clientApp, backgroundImg) => {
|
|
1140
|
+
const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg) => {
|
|
1141
1141
|
const { email } = credentials;
|
|
1142
1142
|
enableSignInLayout();
|
|
1143
1143
|
const onSuccess = (res) => {
|
|
@@ -1148,13 +1148,12 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onReturn, clientApp, back
|
|
|
1148
1148
|
disableSignInLayout();
|
|
1149
1149
|
};
|
|
1150
1150
|
const onError = (err) => {
|
|
1151
|
-
console.error(err);
|
|
1152
|
-
reportError(err);
|
|
1153
1151
|
disableSignInLayout();
|
|
1152
|
+
onLoginError(err);
|
|
1154
1153
|
};
|
|
1155
1154
|
const onUnauthorized = () => {
|
|
1156
1155
|
disableSignInLayout();
|
|
1157
|
-
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn);
|
|
1156
|
+
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn, 'auth-password-fail-info');
|
|
1158
1157
|
const magicLinkEmail = page.querySelector('#magic-link-email');
|
|
1159
1158
|
magicLinkEmail.textContent = email;
|
|
1160
1159
|
displayPage(clientApp, page);
|
|
@@ -1350,7 +1349,7 @@ const authPasswordRow = (type, autoCompleteValue) => {
|
|
|
1350
1349
|
result.append(label, input);
|
|
1351
1350
|
return result;
|
|
1352
1351
|
};
|
|
1353
|
-
const authPasswordForm = (clientApp, loginPage, onUserLogin, backgroundImg) => {
|
|
1352
|
+
const authPasswordForm = (clientApp, loginPage, onUserLogin, onLoginError, backgroundImg) => {
|
|
1354
1353
|
const result = document.createElement('form');
|
|
1355
1354
|
const emailRow = authPasswordRow('email', 'username');
|
|
1356
1355
|
const emailInput = emailRow.querySelector('input');
|
|
@@ -1363,7 +1362,7 @@ const authPasswordForm = (clientApp, loginPage, onUserLogin, backgroundImg) => {
|
|
|
1363
1362
|
passwordInput.type = passwordType;
|
|
1364
1363
|
});
|
|
1365
1364
|
passwordRow.appendChild(togglePasswordDisplayBtn);
|
|
1366
|
-
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onReturn, clientApp, backgroundImg);
|
|
1365
|
+
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg);
|
|
1367
1366
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
1368
1367
|
const button = loginButton('Login', handlePasswordLogin);
|
|
1369
1368
|
button.classList.add('auth-password');
|
|
@@ -1381,7 +1380,7 @@ const onEmailLoginRequest = (clientApp, loginPage, onUserLogin, backgroundImage,
|
|
|
1381
1380
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
1382
1381
|
loginPage.appendChild(magicLinkModal(onUserLogin, onReturn, backgroundImage, loginPage, clientApp, loginTypes));
|
|
1383
1382
|
};
|
|
1384
|
-
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, loginTypes, backgroundImg) => {
|
|
1383
|
+
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg) => {
|
|
1385
1384
|
if (loginTypes.includes('Google')) {
|
|
1386
1385
|
section.appendChild(loginButton('Google', () => onGoogleSignIn(onUserLogin)));
|
|
1387
1386
|
}
|
|
@@ -1395,10 +1394,10 @@ const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, loginTypes
|
|
|
1395
1394
|
section.appendChild(loginButton('Email', () => onEmailLoginRequest(clientApp, loginPage, onUserLogin, backgroundImg, loginTypes)));
|
|
1396
1395
|
}
|
|
1397
1396
|
if (loginTypes.includes('auth-password')) {
|
|
1398
|
-
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, backgroundImg));
|
|
1397
|
+
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, onLoginError, backgroundImg));
|
|
1399
1398
|
}
|
|
1400
1399
|
};
|
|
1401
|
-
const loginPage = (clientApp, backgroundImg, onUserLogin, loginTypes) => {
|
|
1400
|
+
const loginPage = (clientApp, backgroundImg, onUserLogin, onLoginError, loginTypes) => {
|
|
1402
1401
|
const content = [];
|
|
1403
1402
|
const salutation = document.createElement('sign-in-salutation');
|
|
1404
1403
|
salutation.textContent = getTranslation('sign-in-salutation');
|
|
@@ -1409,7 +1408,7 @@ const loginPage = (clientApp, backgroundImg, onUserLogin, loginTypes) => {
|
|
|
1409
1408
|
content.push(salutation, explanation, msg);
|
|
1410
1409
|
const result = basePage('login-page', backgroundImg, content);
|
|
1411
1410
|
const section = result.querySelector('section');
|
|
1412
|
-
appendLoginTypes(result, section, clientApp, onUserLogin, loginTypes, backgroundImg);
|
|
1411
|
+
appendLoginTypes(result, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg);
|
|
1413
1412
|
return result;
|
|
1414
1413
|
};
|
|
1415
1414
|
|
package/dist/main.js
CHANGED
|
@@ -973,7 +973,7 @@ const magicLinkRequestedPage = (backgroundImg, onReturn) => {
|
|
|
973
973
|
return result;
|
|
974
974
|
};
|
|
975
975
|
|
|
976
|
-
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn) => {
|
|
976
|
+
const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn, failInfo) => {
|
|
977
977
|
const content = [];
|
|
978
978
|
const notSent = document.createElement('p');
|
|
979
979
|
notSent.id = 'magic-link-not-sent';
|
|
@@ -985,7 +985,7 @@ const unauthorizedMagicLinkRequestPage = (backgroundImg, onReturn) => {
|
|
|
985
985
|
email.style.marginBottom = '10px';
|
|
986
986
|
const info = document.createElement('p');
|
|
987
987
|
info.id = 'magic-link-fail-info';
|
|
988
|
-
info.innerHTML = getTranslation(info.id);
|
|
988
|
+
info.innerHTML = getTranslation(failInfo || info.id);
|
|
989
989
|
info.style.padding = '0 30px';
|
|
990
990
|
info.style.textAlign = 'center';
|
|
991
991
|
const back = document.createElement('a');
|
|
@@ -1065,7 +1065,7 @@ const handleSSOLogin = () => {
|
|
|
1065
1065
|
const onError = () => onAuthenticationFailure('login-failed');
|
|
1066
1066
|
getSSOAuthorizationEndpoint(onSuccess, onError);
|
|
1067
1067
|
};
|
|
1068
|
-
const initSession = (clientApp, supportedLoginTypes, onUserLogin, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
1068
|
+
const initSession = (clientApp, supportedLoginTypes, onUserLogin, onLoginError, backgroundImage, fetchUserBackendUrl, magicLinkRequestEndpoint, magicLinkAuthEndpoint) => {
|
|
1069
1069
|
// if (startNewDemo()) {
|
|
1070
1070
|
// initDemo(setBackendToken, onAuthentication);
|
|
1071
1071
|
// return;
|
|
@@ -1119,7 +1119,7 @@ const initSession = (clientApp, supportedLoginTypes, onUserLogin, backgroundImag
|
|
|
1119
1119
|
handleSSOLogin();
|
|
1120
1120
|
return;
|
|
1121
1121
|
}
|
|
1122
|
-
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, supportedLoginTypes));
|
|
1122
|
+
displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypes));
|
|
1123
1123
|
// validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
|
|
1124
1124
|
// checkMixpanel(() => mixpanel.track('View Login Page'));
|
|
1125
1125
|
};
|
|
@@ -1161,7 +1161,7 @@ const onGoogleSignIn = (onUserLogin) => {
|
|
|
1161
1161
|
authSignIn(onUserLogin);
|
|
1162
1162
|
}, onCookieError);
|
|
1163
1163
|
};
|
|
1164
|
-
const onAuthPasswordLogin = (credentials, onUserLogin, onReturn, clientApp, backgroundImg) => {
|
|
1164
|
+
const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg) => {
|
|
1165
1165
|
const { email } = credentials;
|
|
1166
1166
|
enableSignInLayout();
|
|
1167
1167
|
const onSuccess = (res) => {
|
|
@@ -1172,13 +1172,12 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onReturn, clientApp, back
|
|
|
1172
1172
|
disableSignInLayout();
|
|
1173
1173
|
};
|
|
1174
1174
|
const onError = (err) => {
|
|
1175
|
-
console.error(err);
|
|
1176
|
-
reportError(err);
|
|
1177
1175
|
disableSignInLayout();
|
|
1176
|
+
onLoginError(err);
|
|
1178
1177
|
};
|
|
1179
1178
|
const onUnauthorized = () => {
|
|
1180
1179
|
disableSignInLayout();
|
|
1181
|
-
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn);
|
|
1180
|
+
const page = unauthorizedMagicLinkRequestPage(backgroundImg, onReturn, 'auth-password-fail-info');
|
|
1182
1181
|
const magicLinkEmail = page.querySelector('#magic-link-email');
|
|
1183
1182
|
magicLinkEmail.textContent = email;
|
|
1184
1183
|
displayPage(clientApp, page);
|
|
@@ -1374,7 +1373,7 @@ const authPasswordRow = (type, autoCompleteValue) => {
|
|
|
1374
1373
|
result.append(label, input);
|
|
1375
1374
|
return result;
|
|
1376
1375
|
};
|
|
1377
|
-
const authPasswordForm = (clientApp, loginPage, onUserLogin, backgroundImg) => {
|
|
1376
|
+
const authPasswordForm = (clientApp, loginPage, onUserLogin, onLoginError, backgroundImg) => {
|
|
1378
1377
|
const result = document.createElement('form');
|
|
1379
1378
|
const emailRow = authPasswordRow('email', 'username');
|
|
1380
1379
|
const emailInput = emailRow.querySelector('input');
|
|
@@ -1387,7 +1386,7 @@ const authPasswordForm = (clientApp, loginPage, onUserLogin, backgroundImg) => {
|
|
|
1387
1386
|
passwordInput.type = passwordType;
|
|
1388
1387
|
});
|
|
1389
1388
|
passwordRow.appendChild(togglePasswordDisplayBtn);
|
|
1390
|
-
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onReturn, clientApp, backgroundImg);
|
|
1389
|
+
const handlePasswordLogin = () => onAuthPasswordLogin({ email: emailInput.value, password: passwordInput.value || null }, onUserLogin, onLoginError, onReturn, clientApp, backgroundImg);
|
|
1391
1390
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
1392
1391
|
const button = loginButton('Login', handlePasswordLogin);
|
|
1393
1392
|
button.classList.add('auth-password');
|
|
@@ -1405,7 +1404,7 @@ const onEmailLoginRequest = (clientApp, loginPage, onUserLogin, backgroundImage,
|
|
|
1405
1404
|
const onReturn = () => clientApp.appendChild(loginPage);
|
|
1406
1405
|
loginPage.appendChild(magicLinkModal(onUserLogin, onReturn, backgroundImage, loginPage, clientApp, loginTypes));
|
|
1407
1406
|
};
|
|
1408
|
-
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, loginTypes, backgroundImg) => {
|
|
1407
|
+
const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg) => {
|
|
1409
1408
|
if (loginTypes.includes('Google')) {
|
|
1410
1409
|
section.appendChild(loginButton('Google', () => onGoogleSignIn(onUserLogin)));
|
|
1411
1410
|
}
|
|
@@ -1419,10 +1418,10 @@ const appendLoginTypes = (loginPage, section, clientApp, onUserLogin, loginTypes
|
|
|
1419
1418
|
section.appendChild(loginButton('Email', () => onEmailLoginRequest(clientApp, loginPage, onUserLogin, backgroundImg, loginTypes)));
|
|
1420
1419
|
}
|
|
1421
1420
|
if (loginTypes.includes('auth-password')) {
|
|
1422
|
-
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, backgroundImg));
|
|
1421
|
+
section.appendChild(authPasswordForm(clientApp, loginPage, onUserLogin, onLoginError, backgroundImg));
|
|
1423
1422
|
}
|
|
1424
1423
|
};
|
|
1425
|
-
const loginPage = (clientApp, backgroundImg, onUserLogin, loginTypes) => {
|
|
1424
|
+
const loginPage = (clientApp, backgroundImg, onUserLogin, onLoginError, loginTypes) => {
|
|
1426
1425
|
const content = [];
|
|
1427
1426
|
const salutation = document.createElement('sign-in-salutation');
|
|
1428
1427
|
salutation.textContent = getTranslation('sign-in-salutation');
|
|
@@ -1433,7 +1432,7 @@ const loginPage = (clientApp, backgroundImg, onUserLogin, loginTypes) => {
|
|
|
1433
1432
|
content.push(salutation, explanation, msg);
|
|
1434
1433
|
const result = basePage('login-page', backgroundImg, content);
|
|
1435
1434
|
const section = result.querySelector('section');
|
|
1436
|
-
appendLoginTypes(result, section, clientApp, onUserLogin, loginTypes, backgroundImg);
|
|
1435
|
+
appendLoginTypes(result, section, clientApp, onUserLogin, onLoginError, loginTypes, backgroundImg);
|
|
1437
1436
|
return result;
|
|
1438
1437
|
};
|
|
1439
1438
|
|