mario-core 1.2.16-es-prod → 1.2.18-es-prod

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.
@@ -25,5 +25,6 @@ declare const useLogin: () => {
25
25
  school: ISchool;
26
26
  fnLoginSSO: (clickHandler?: any) => Promise<void>;
27
27
  handleLoginWidthClever: () => void;
28
+ extensionEmail: string;
28
29
  };
29
30
  export default useLogin;
package/dist/index.js CHANGED
@@ -22461,7 +22461,7 @@ var getSchoolSettings = function getSchoolSettings() {
22461
22461
 
22462
22462
  var msalConfig = {
22463
22463
  auth: {
22464
- clientId: isLocalhost ? "3845e9f8-aead-4535-b4bb-d363a1d262bd" : "3845e9f8-aead-4535-b4bb-d363a1d262bd",
22464
+ clientId: isLocalhost ? "bd08aff8-9e68-4987-9943-2525d4441d4f" : "3845e9f8-aead-4535-b4bb-d363a1d262bd",
22465
22465
  authority: "https://login.microsoftonline.com/common",
22466
22466
  redirectUri: "https://es-sso.marioforme.com/microsoft-login.html"
22467
22467
  },
@@ -22567,6 +22567,10 @@ var useLogin = function useLogin() {
22567
22567
  isShowPassword = _useState8[0],
22568
22568
  setIsShowPassword = _useState8[1];
22569
22569
 
22570
+ var _useState9 = React.useState(""),
22571
+ extensionEmail = _useState9[0],
22572
+ setExtensionEmail = _useState9[1];
22573
+
22570
22574
  React.useEffect(function () {
22571
22575
  document.title = TITLE;
22572
22576
  var authToken = getCookieValue("auth-token");
@@ -22669,6 +22673,7 @@ var useLogin = function useLogin() {
22669
22673
  return Promise.resolve(getGoogleClientId()).then(function (res) {
22670
22674
  setGoogleClientId(res.data.googleClientId);
22671
22675
  setGoogleRecaptchaId(res.data.googleCaptchaId);
22676
+ setExtensionEmail(res.data.extensionEmail);
22672
22677
  });
22673
22678
  }, function (err) {
22674
22679
  var _err$response2, _err$response2$data;
@@ -22794,6 +22799,8 @@ var useLogin = function useLogin() {
22794
22799
  try {
22795
22800
  msalInstance.handleRedirectPromise().then(function (tokenResponse) {
22796
22801
  try {
22802
+ if (!(school !== null && school !== void 0 && school.schoolId)) return Promise.resolve();
22803
+
22797
22804
  var _temp19 = function () {
22798
22805
  if (!tokenResponse) {
22799
22806
  var accounts = msalInstance.getAllAccounts();
@@ -22912,7 +22919,8 @@ var useLogin = function useLogin() {
22912
22919
  googleRecaptchaId: googleRecaptchaId,
22913
22920
  school: school,
22914
22921
  fnLoginSSO: fnLoginSSO,
22915
- handleLoginWidthClever: handleLoginWidthClever
22922
+ handleLoginWidthClever: handleLoginWidthClever,
22923
+ extensionEmail: extensionEmail
22916
22924
  };
22917
22925
  };
22918
22926
 
@@ -23096,7 +23104,8 @@ var BlockLogin = function BlockLogin(_ref) {
23096
23104
  infoUser = _useLogin.infoUser,
23097
23105
  setIsLoginGoogle = _useLogin.setIsLoginGoogle,
23098
23106
  googleClientId = _useLogin.googleClientId,
23099
- fnLoginSSO = _useLogin.fnLoginSSO;
23107
+ fnLoginSSO = _useLogin.fnLoginSSO,
23108
+ extensionEmail = _useLogin.extensionEmail;
23100
23109
 
23101
23110
  var togglePasswordVisible = function togglePasswordVisible() {
23102
23111
  return setIsShowPassword(!isShowPassword);
@@ -23124,6 +23133,8 @@ var BlockLogin = function BlockLogin(_ref) {
23124
23133
 
23125
23134
  var onSuccessGoogle = function onSuccessGoogle(res) {
23126
23135
  if (!!(res !== null && res !== void 0 && res.accessToken)) {
23136
+ var _hostName$split, _hostName$split$, _email$split;
23137
+
23127
23138
  var _res$profileObj = res.profileObj,
23128
23139
  email = _res$profileObj.email,
23129
23140
  familyName = _res$profileObj.familyName,
@@ -23132,6 +23143,15 @@ var BlockLogin = function BlockLogin(_ref) {
23132
23143
  name = _res$profileObj.name;
23133
23144
  var accessToken = res.accessToken;
23134
23145
  var googleId = res.googleId;
23146
+ var hostName = window.location.hostname;
23147
+ var subDomain = hostName === null || hostName === void 0 ? void 0 : (_hostName$split = hostName.split(".marioforme.com")) === null || _hostName$split === void 0 ? void 0 : (_hostName$split$ = _hostName$split[0]) === null || _hostName$split$ === void 0 ? void 0 : _hostName$split$.replace(/-es$|^es-/, "");
23148
+ var emailDomain = (_email$split = email.split("@")) === null || _email$split === void 0 ? void 0 : _email$split[1];
23149
+
23150
+ if (!emailDomain.includes(subDomain) && !emailDomain.includes(extensionEmail)) {
23151
+ alert("The email address you used does not match the login information in the database. Please check that you are using your school assigned email address to log into MARIO for Me. If you have further trouble please notify your school site administrator");
23152
+ return;
23153
+ }
23154
+
23135
23155
  var infoLogin = {
23136
23156
  firstName: givenName,
23137
23157
  lastName: familyName,
@@ -23255,7 +23275,8 @@ var BlockLogin = function BlockLogin(_ref) {
23255
23275
  lg: 6,
23256
23276
  md: 6,
23257
23277
  xs: 12,
23258
- className: styles["btn-login-sso"] + " pl-md-2"
23278
+ className: styles["btn-login-sso"] + " pl-md-2",
23279
+ hidden: !(school !== null && school !== void 0 && school.schoolId)
23259
23280
  }, React__default.createElement("div", {
23260
23281
  className: styles["btn-login-with-sso"],
23261
23282
  onClick: function onClick() {