mario-core 2.9.209-release → 2.9.212-release

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ButtonLogin: ({ fnLoginSSO }: any) => JSX.Element;
3
+ export default ButtonLogin;
@@ -0,0 +1,38 @@
1
+ import { LogLevel } from "@azure/msal-browser";
2
+ /**
3
+ * Configuration object to be passed to MSAL instance on creation.
4
+ * For a full list of MSAL.js configuration parameters, visit:
5
+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
6
+ */
7
+ export declare const msalConfig: {
8
+ auth: {
9
+ clientId: string;
10
+ authority: string;
11
+ redirectUri: string;
12
+ };
13
+ cache: {
14
+ cacheLocation: string;
15
+ storeAuthStateInCookie: boolean;
16
+ };
17
+ system: {
18
+ loggerOptions: {
19
+ loggerCallback: (level: LogLevel, message: string, containsPii: any) => void;
20
+ };
21
+ };
22
+ };
23
+ /**
24
+ * Scopes you add here will be prompted for user consent during sign-in.
25
+ * By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request.
26
+ * For more information about OIDC scopes, visit:
27
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes
28
+ */
29
+ export declare const loginRequest: {
30
+ scopes: string[];
31
+ };
32
+ /**
33
+ * Add here the scopes to request when obtaining an access token for MS Graph API. For more information, see:
34
+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/resources-and-scopes.md
35
+ */
36
+ export declare const graphConfig: {
37
+ graphMeEndpoint: string;
38
+ };
@@ -0,0 +1,6 @@
1
+ export declare const config: {
2
+ appId: string;
3
+ redirectUri: string;
4
+ scopes: string[];
5
+ authority: string;
6
+ };
package/dist/index.js CHANGED
@@ -22381,6 +22381,10 @@ var useLogin = function useLogin() {
22381
22381
  profileImageFileName: profileImageFileName
22382
22382
  }));
22383
22383
 
22384
+ if (!localStorage.getItem("ROLES") && roles.includes("Admin")) {
22385
+ localStorage.setItem("ROLES", "Admin");
22386
+ }
22387
+
22384
22388
  if (data !== null && data !== void 0 && data.email && !roles.includes("Admin")) {
22385
22389
  var _data$roles;
22386
22390
 
@@ -22810,6 +22814,12 @@ var BlockLogin = function BlockLogin(_ref) {
22810
22814
  name = _res$profileObj.name;
22811
22815
  var accessToken = res.accessToken;
22812
22816
  var googleId = res.googleId;
22817
+
22818
+ if (email.includes("@gmail")) {
22819
+ alert("Please login with your school email");
22820
+ return;
22821
+ }
22822
+
22813
22823
  var infoLogin = {
22814
22824
  firstName: givenName,
22815
22825
  lastName: familyName,
@@ -23788,6 +23798,7 @@ var TheSidebar = function TheSidebar(_ref) {
23788
23798
 
23789
23799
  var signOut = React.useCallback(function () {
23790
23800
  localStorage.removeItem(ACCESS_TOKEN);
23801
+ localStorage.removeItem("ROLES");
23791
23802
  dispatch(reset());
23792
23803
  history.push("/");
23793
23804
  }, []);
@@ -23980,6 +23991,7 @@ var TheHeaderDropdown = function TheHeaderDropdown(_ref) {
23980
23991
  var isTeacher = roles.includes(TEACHER_ROLE);
23981
23992
  var signOut = React.useCallback(function () {
23982
23993
  localStorage.removeItem(ACCESS_TOKEN);
23994
+ localStorage.removeItem("ROLES");
23983
23995
  dispatch(reset());
23984
23996
  history.push("/");
23985
23997
  }, []);
@@ -24291,11 +24303,7 @@ var ModelSelectRole = function ModelSelectRole(_ref) {
24291
24303
  var roles = user === null || user === void 0 ? void 0 : user.roles;
24292
24304
 
24293
24305
  var handleSelectUserRoles = function handleSelectUserRoles(roles) {
24294
- if (roles.includes("Admin")) {
24295
- dispatch(setLoading(true));
24296
- return history.push("/admin/dashboard");
24297
- }
24298
-
24306
+ dispatch(setLoading(true));
24299
24307
  var roleSelect = roles.includes("Teacher/Assistant") ? ["Teacher", "Assistant"] : roles;
24300
24308
  dispatch(setUser(_extends({}, user, {
24301
24309
  roles: roleSelect
@@ -24305,6 +24313,8 @@ var ModelSelectRole = function ModelSelectRole(_ref) {
24305
24313
 
24306
24314
  if (roles.includes("Parent")) {
24307
24315
  history.push("/parent");
24316
+ } else if (roles.includes("Admin")) {
24317
+ history.push("/admin/dashboard");
24308
24318
  } else {
24309
24319
  pathname !== "/home" ? history.push("/home") : window.location.reload();
24310
24320
  }