Skip to content

Commit

Permalink
feat(fe): save sensitive personal data in the local storage to be use…
Browse files Browse the repository at this point in the history
…d in report.
  • Loading branch information
irumvanselme committed Jan 21, 2025
1 parent f23657d commit ccf2a55
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PersistentStorageService } from "src/app/PersistentStorageService/PersistentStorageService";
import { SensitivePersonalDataRequirement } from "src/userPreferences/UserPreferencesService/userPreferences.types";
import { Invitation, InvitationStatus, InvitationType } from "src/auth/services/invitationsService/invitations.types";
import { StoredPersonalInfo } from "src/experiences/experiencesDrawer/experienceService/experiences.types";
import { StoredPersonalInfo } from "src/sensitiveData/types";

describe("AuthPersistentStorage class tests", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Invitation } from "src/auth/services/invitationsService/invitations.types";
import { StoredPersonalInfo } from "../../experiences/experiencesDrawer/experienceService/experiences.types";
import { StoredPersonalInfo } from "src/sensitiveData/types";

const PERSISTENT_STORAGE_VERSION = "0.0.1";
export const TOKEN_KEY = `token_${PERSISTENT_STORAGE_VERSION}`;
Expand Down
289 changes: 289 additions & 0 deletions frontend-new/src/auth/pages/Login/__snapshots__/Login.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing Login component it should show login form successfully 1`] = `
<div
class="MuiContainer-root MuiContainer-maxWidthXs css-1ubnw5l-MuiContainer-root"
data-testid="login-container-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
>
<div
aria-hidden="true"
class="MuiBackdrop-root css-hdzoti-MuiBackdrop-root"
data-testid="backdrop-91b57774-d50c-4350-882d-363f80ac10e8"
style="opacity: 0; visibility: hidden;"
>
<div
data-testid="sloth-5f51c2ff-74cd-4a23-98b4-0c1f5404d5ee"
style="position: relative; margin: 0px; padding: 0px;"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation24 css-14c64kg-MuiPaper-root"
>
<div
class="MuiGrid-root MuiGrid-container css-15vmx7d-MuiGrid-root"
>
<div
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-j3fu9i-MuiTypography-root"
data-testid="message-91b57774-d50c-4350-882d-363f80ac10e8"
>
Logging you in...
</h6>
</div>
<div
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
style="line-height: 0;"
>
<span
class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary css-1tmrh9l-MuiCircularProgress-root"
data-testid="progress-91b57774-d50c-4350-882d-363f80ac10e8"
role="progressbar"
style="width: 32px; height: 32px;"
>
<svg
class="MuiCircularProgress-svg css-1idz92c-MuiCircularProgress-svg"
viewBox="22 22 44 44"
>
<circle
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate css-176wh8e-MuiCircularProgress-circle"
cx="44"
cy="44"
fill="none"
r="20.2"
stroke-width="3.6"
/>
</svg>
</span>
</div>
</div>
</div>
<div
class="MuiContainer-root MuiContainer-maxWidthLg css-t4utv2-MuiContainer-root"
>
<svg
overflow="visible"
style="z-index: 1301; position: absolute; left: 0px;"
viewBox="0 0 128 176"
width="64px"
xmlns="http://www.w3.org/2000/svg"
>
<g
id="sloth-arm"
style="fill:rgb(166, 178, 45);fill-opacity:1"
>
<path
d="m 14.514759,154.02465 c -0.223222,7.54279 1.889033,14.31023 6.003671,20.12666"
id="path11933"
style="stroke:#002147;stroke-width:3.43002;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 18.102994,156.94 c 0.876984,6.63374 3.47077,12.36155 7.569543,17.07907"
id="path11935"
style="stroke:#002147;stroke-width:3.43002;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 22.590384,155.6948 c -0.02644,6.78986 4.860219,11.28627 8.356559,15.96141"
id="path11937"
style="stroke:#002147;stroke-width:3.43002;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 16.155526,92.631962 c -2.397382,14.608358 -5.018547,40.414198 -2.309374,58.794228 1.345636,10.71389 13.390445,3.26402 10.026414,-4.80477 -0.185829,-10.97318 3.22198,-26.38245 9.483242,-35.8906"
id="path10943"
style="display:inline;stroke:#002147;stroke-width:4.0018;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
</g>
<g
id="sloth-body"
style="fill:rgb(166, 178, 45);fill-opacity:1"
>
<path
d="M 90.43732,62.124738 C 80.765159,72.143232 61.675685,73.505359 58.059543,66.476431 56.322681,63.10038 57.085072,48.491863 55.800698,45.613442 51.842764,36.743284 42.253159,33.966119 32.313919,33.185915 30.379026,33.034031 30.27136,32.592447 26.491469,33.096325 l -2.825741,0.376686 C 9.9437551,35.302218 0.26032252,46.069416 2.2065025,59.935389 3.0716644,80.339077 10.912511,102.04229 28.700604,113.58067 c 13.577672,9.16985 30.624678,11.41364 46.669719,10.83986 18.268794,-0.877 37.706797,-9.99707 44.895357,-27.827253 5.42971,-13.34508 6.81554,-28.317784 4.94335,-42.535971 -0.6407,-6.66636 -6.04889,-6.606256 -7.19109,0.300158 -0.57049,3.449516 -4.15524,10.764389 -6.01114,3.299577 "
id="path356"
style="stroke:#002147;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
/>
</g>
<g
id="sloth-face"
style="fill:#EEFF41;fill-opacity:1"
>
<path
d="m 14.097135,45.06275 c 6.594093,-3.092353 13.024301,4.64989 19.788171,1.505066 5.845188,-3.519947 15.063887,-2.847274 15.553048,5.557662 1.504572,8.883565 -2.696937,20.630621 -12.677006,22.055619 -9.206273,2.426258 -21.888604,0.05935 -25.533835,-9.789371 C 9.7964043,58.277976 8.9129239,49.606375 14.097135,45.06275 Z"
id="path1068"
style="stroke:#002147;stroke-width:4.24961;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="M 25.150328,53.598222 C 19.5057,53.230017 15.33792,56.597843 12.015927,60.78691"
id="path1076"
style="stroke:#002147;stroke-width:4.24961;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 35.397394,53.690084 c 5.301525,0.26916 9.127221,3.370397 12.03295,7.622747"
id="path1078"
style="stroke:#002147;stroke-width:4.24961;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 23.623698,61.785599 c 4.082759,1.95693 8.532002,2.209343 12.661822,0.186749"
id="path1260"
style="stroke:#002147;stroke-width:4.24961;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
</g>
<path
d="m 90.118843,62.518213 c 0,0 6.483175,-9.799709 7.212019,-16.207953 1.536074,-13.505678 1.472686,-33.390562 -1.085642,-36.8551862 -1.8363,-2.4867984 2.553319,-7.0642704 5.62356,-7.2690653 4.47491,-0.2984939 6.86184,7.7656371 7.13595,12.7506545 0.65157,11.849278 -0.35635,22.14692 0.7275,32.644203 0.45452,4.402105 2.77413,12.15515 2.77413,12.15515"
id="sloth-leg"
style="fill:rgb(166, 178, 45);fill-opacity:1;stroke:#002147;stroke-width:4;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
/>
<path
d="m 50.395651,79.193064 c 0,0 13.690628,-15.002471 14.631855,-34.293484 0.435414,-8.924059 2.308685,-21.46904 -0.196491,-30.411566 -0.935496,-3.339364 -8.661263,-2.000533 -8.853989,-5.4631001 -0.203842,-3.662289 5.01835,-6.392621 8.665606,-6.781779 4.579867,-0.488665 10.670019,1.635917 12.433262,6.028249 5.078151,12.6499451 4.629924,21.9263741 5.069182,33.0697121 0.395593,10.035614 6.26e-4,20.251473 -2.206773,30.0493 -1.23259,5.471008 -2.969712,11.280552 -6.082137,15.686572 -6.830033,9.66876 -9.363708,10.642509 -9.363708,10.642509"
id="sloth-top-arm"
style="fill:rgb(166, 178, 45);fill-opacity:1;stroke:#002147;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
/>
</svg>
</div>
</div>
</div>
<div
class="MuiBox-root css-1wo1se4"
>
<div
class="MuiBox-root css-jwp3xc"
data-testid="auth-header-container-40374529-6e2c-49d8-81d7-93f01603a648"
>
<div
class="MuiBox-root css-1vd84sn"
>
<img
alt="Logo"
data-testid="auth-header-logo-40374529-6e2c-49d8-81d7-93f01603a648"
src="/logo.svg"
style="max-width: 60%; margin: 5% 10%;"
/>
<button
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorPrimary MuiIconButton-sizeMedium css-9hi4fq-MuiButtonBase-root-MuiIconButton-root"
data-testid="auth-language-selector-f4d06e4b-0e0c-49c7-ad93-924c5ac89070"
tabindex="0"
title="Language Selector"
type="button"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-etbowg-MuiSvgIcon-root"
data-testid="LanguageOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"
/>
</svg>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</div>
<h4
class="MuiTypography-root MuiTypography-h4 MuiTypography-gutterBottom css-xvfkrl-MuiTypography-root"
data-testid="auth-header-title-40374529-6e2c-49d8-81d7-93f01603a648"
>
Welcome to Compass!
</h4>
<p
class="MuiTypography-root MuiTypography-body2 MuiTypography-gutterBottom css-1amuzo8-MuiTypography-root"
data-testid="auth-header-title=40374529-6e2c-49d8-81d7-93f01603a648"
>
Login to your account to continue
</p>
</div>
<form
class="MuiBox-root css-byhydz"
data-testid="login-form-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 css-ohbpz3-MuiTypography-root"
data-testid="login-subtitle-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
>
Login using
</h6>
<span
data-testid="login-form-300d373e-b913-4bd5-9045-3a28d490cf2c"
/>
<div
class="MuiDivider-root MuiDivider-fullWidth MuiDivider-withChildren css-1puturl-MuiDivider-root"
role="separator"
style="width: 100%;"
>
<span
class="MuiDivider-wrapper css-8j2o7p-MuiDivider-wrapper"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 css-zq12aa-MuiTypography-root"
data-testid="login-subtitle-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
>
Or
</h6>
</span>
</div>
<span />
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary MuiButton-disableElevation MuiButton-fullWidth Mui-disabled MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-colorPrimary MuiButton-disableElevation MuiButton-fullWidth css-1jkonhr-MuiButtonBase-root-MuiButton-root"
data-testid="login-button-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
disabled=""
style="margin-top: 8px;"
tabindex="-1"
type="submit"
>
Login
</button>
</form>
<span
data-testid="firebase-auth-container-f0324e97-83fd-49e6-95c3-1043751fa1db"
/>
<p
class="MuiTypography-root MuiTypography-body2 css-t9py5r-MuiTypography-root"
data-testid="login-login-link-7ce9ba1f-bde0-48e2-88df-e4f697945cc4"
>
Don't have an account?
</p>
</div>
<span
data-testid="bug-report-button-container-31d2b110-8308-4035-90a6-519e89e7f6fa"
/>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Box, Divider, Drawer, Typography, useMediaQuery, useTheme } from "@mui/
import { Theme } from "@mui/material/styles";
import ExperiencesDrawerHeader from "src/experiences/experiencesDrawer/components/experiencesDrawerHeader/ExperiencesDrawerHeader";
import { LoadingExperienceDrawerContent } from "src/experiences/experiencesDrawer/components/experiencesDrawerContent/ExperiencesDrawerContent";
import { Experience, StoredPersonalInfo } from "src/experiences/experiencesDrawer/experienceService/experiences.types";
import { Experience } from "src/experiences/experiencesDrawer/experienceService/experiences.types";
import { StoredPersonalInfo } from "src/sensitiveData/types";
import CustomTextField from "src/theme/CustomTextField/CustomTextField";
import CustomAccordion from "src/theme/CustomAccordion/CustomAccordion";
import { PersistentStorageService } from "src/app/PersistentStorageService/PersistentStorageService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@ export interface Experience {
work_type: WorkType;
top_skills: Skill[];
}

export interface StoredPersonalInfo {
name: string;
phone: string;
email: string;
address: string;
}
Loading

0 comments on commit ccf2a55

Please sign in to comment.