Commit 5690006f authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

refactored so signUp component is semf contained in its own file

parent 498a7bbb
[{"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js":"1","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.jsx":"2","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js":"3","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.jsx":"4","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useInput.jsx":"5","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.jsx":"6","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.jsx":"7","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.jsx":"8","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.jsx":"9","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.jsx":"10","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.jsx":"11","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.jsx":"12","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.jsx":"13","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.jsx":"14","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.jsx":"15","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.jsx":"16","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.jsx":"17","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.jsx":"18","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.jsx":"19","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.jsx":"20","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.jsx":"21","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.jsx":"22","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.jsx":"23"},{"size":285,"mtime":1628516023915,"results":"24","hashOfConfig":"25"},{"size":2100,"mtime":1630074941213,"results":"26","hashOfConfig":"25"},{"size":473,"mtime":1629901058454,"results":"27","hashOfConfig":"25"},{"size":1489,"mtime":1629790769379,"results":"28","hashOfConfig":"25"},{"size":324,"mtime":1629371594261,"results":"29","hashOfConfig":"25"},{"size":7847,"mtime":1630092443383,"results":"30","hashOfConfig":"25"},{"size":626,"mtime":1628697746462,"results":"31","hashOfConfig":"25"},{"size":3967,"mtime":1628695632288,"results":"32","hashOfConfig":"25"},{"size":1279,"mtime":1630089091700,"results":"33","hashOfConfig":"25"},{"size":1068,"mtime":1628696051327,"results":"34","hashOfConfig":"25"},{"size":3660,"mtime":1629794572456,"results":"35","hashOfConfig":"25"},{"size":2374,"mtime":1628696187694,"results":"36","hashOfConfig":"25"},{"size":2694,"mtime":1628696113184,"results":"37","hashOfConfig":"25"},{"size":3264,"mtime":1628535700010,"results":"38","hashOfConfig":"25"},{"size":2334,"mtime":1630060568411,"results":"39","hashOfConfig":"25"},{"size":2096,"mtime":1628430812599,"results":"40","hashOfConfig":"25"},{"size":3570,"mtime":1628430832688,"results":"41","hashOfConfig":"25"},{"size":906,"mtime":1630073002522,"results":"42","hashOfConfig":"25"},{"size":548,"mtime":1628421916010,"results":"43","hashOfConfig":"25"},{"size":697,"mtime":1628430740299,"results":"44","hashOfConfig":"25"},{"size":470,"mtime":1628430752153,"results":"45","hashOfConfig":"25"},{"size":3533,"mtime":1630069281308,"results":"46","hashOfConfig":"25"},{"size":4009,"mtime":1630090234456,"results":"47","hashOfConfig":"25"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},"iyhzrm",{"filePath":"51","messages":"52","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"53","messages":"54","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"55","usedDeprecatedRules":"50"},{"filePath":"56","messages":"57","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"58","usedDeprecatedRules":"50"},{"filePath":"59","messages":"60","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"61"},{"filePath":"62","messages":"63","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"64","messages":"65","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},{"filePath":"66","messages":"67","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"68","usedDeprecatedRules":"50"},{"filePath":"69","messages":"70","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"71","messages":"72","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},{"filePath":"73","messages":"74","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"75","usedDeprecatedRules":"50"},{"filePath":"76","messages":"77","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"78","usedDeprecatedRules":"50"},{"filePath":"79","messages":"80","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"81","usedDeprecatedRules":"50"},{"filePath":"82","messages":"83","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"84","usedDeprecatedRules":"50"},{"filePath":"85","messages":"86","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"87","usedDeprecatedRules":"50"},{"filePath":"88","messages":"89","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"90","usedDeprecatedRules":"50"},{"filePath":"91","messages":"92","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},{"filePath":"93","messages":"94","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"95","messages":"96","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"97","usedDeprecatedRules":"50"},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},{"filePath":"100","messages":"101","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"50"},{"filePath":"102","messages":"103","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"104","usedDeprecatedRules":"50"},{"filePath":"105","messages":"106","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js",[],["107","108"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js",["109"],"export default {\r\n oidc: {\r\n clientId: '0oa1f4zfeiiZPB6DF5d7',\r\n issuer: 'https://dev-91882654.okta.com/oauth2/default',\r\n redirectUri: window.location.origin + '/login/callback',\r\n scopes: ['openid', 'profile', 'email'],\r\n pkce: true\r\n },\r\n serviceAPI: {\r\n messagesURL: 'http://localhost:3030/api/messages',\r\n createNewUserURL: 'http://localhost:3030/api/create-user',\r\n resetPasswordURL: 'http://localhost:3030/api/reset-user-password'\r\n }\r\n};","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.jsx",["110"],"import { useState, useEffect } from 'react';\r\nimport { useOktaAuth } from '@okta/okta-react';\r\n\r\nimport config from \"../config\"\r\n\r\nconst useMessages = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [messages, setMessages] = useState(null);\r\n\r\n // fetch messages\r\n useEffect(() => {\r\n if (authState && authState.isAuthenticated) {\r\n const accessToken = oktaAuth.getAccessToken();\r\n fetch(config.serviceAPI.messagesURL, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n })\r\n .then((response) => {\r\n if (!response.ok) {\r\n return Promise.reject();\r\n }\r\n return response.json();\r\n })\r\n .then((data) => {\r\n let index = 0;\r\n const formattedMessages = data.messages.map((message) => {\r\n const date = new Date(message.date);\r\n const day = date.toLocaleDateString();\r\n const time = date.toLocaleTimeString();\r\n index += 1;\r\n return {\r\n date: `${day} ${time}`,\r\n sender: message.sender,\r\n text: message.text,\r\n id: `message-${index}`,\r\n };\r\n });\r\n setMessages(formattedMessages);\r\n })\r\n .catch((err) => {\r\n /* eslint-disable no-console */\r\n console.error(err);\r\n });\r\n }\r\n }, [authState]);\r\n\r\n return messages\r\n}\r\n\r\nexport default useMessages","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useInput.jsx",[],["111","112"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.jsx",["113","114","115","116","117"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.jsx",["118"],"import React, { useState } from 'react'\r\nimport \"./ReportForm.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Assign from './assign/Assign'\r\n\r\nconst ReportForm = () => {\r\n return (\r\n <div className=\"page-content-container\">\r\n <h2 className=\"reportissuePageText\">Report an issue</h2>\r\n <form action=\"/reportFormData\">\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueType\">Type of issue</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueType\" className=\"issueType\">\r\n <option value=\"bug\">Bug</option>\r\n <option value=\"usabilityissue\">Usability error</option>\r\n <option value=\"other\">Other</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueLocation\">Where did you encounter the issue?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <input type=\"text\" id=\"fissueLocation\" className=\"issueLocation\" ></input>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueDescription\">Describe the issue</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueDescription\" className=\"issueDescription\"></textarea>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueStepsToTeproduce\">What steps did you take before the issue happened?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueStepsToTeproduce\" className=\"issueStepsToReproduce\"\r\n placeholder=\"List the steps that occurred before the issue happened:\r\n1.\r\n2.\r\n3.\r\nExpected Result:\r\nActual Result:\">\r\n </textarea>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueSeverity\">Severity level</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueSeverity\">\r\n <option value=\"cosmetic\">Cosmetic - should be corrected when time permits</option>\r\n <option value=\"serious\">Serious - should be corrected in the next release</option>\r\n <option value=\"critical\">Critical - should be corrected as soon as possible</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueTimeToCorrect\">Time to Correct</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueTimeToCorrect\">\r\n <option value=\"lessThanTwoHours\">Less than 2 minutes</option>\r\n <option value=\"lessThanOneToTwoDays\">Less than 1 or 2 days</option>\r\n <option value=\"lessThanOneToTwoWeeks\">Less than 1 or 2 weeks</option>\r\n <option value=\"atLeastTwoWeeks\">More than 2 weeks</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueAssignToProject\">Assign to</label>\r\n </div>\r\n <div className=\"col-75\">\r\n {/*\r\n <select id=\"fissueAssignToProject\" className=\"issueAssignToProject\">\r\n <option value=\"lessThanTwoHours\">Henriks meme machine - ReactApp</option>\r\n </select>\r\n */}\r\n <Assign />\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row\">\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </div>\r\n </form>\r\n </div >\r\n )\r\n}\r\n\r\nexport default ReportForm","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.jsx",["119","120"],"import React, { useState } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport \"./ProjectOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst ProjectOverview = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n const [sharedProjectsButtonState, setSharedProjectsButtonState] = useState(true);\r\n const [personalProjectsButtonState, setPersonalProjectsButtonState] = useState(false);\r\n\r\n const SharedProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(true);\r\n setPersonalProjectsButtonState(false);\r\n };\r\n\r\n const PersonalProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(false);\r\n setPersonalProjectsButtonState(true);\r\n };\r\n\r\n const ProjectsDisplay = (projects) => {\r\n return (\r\n <div className=\"projectlist\">\r\n <ul>\r\n {projects.map((elements, index) => (\r\n <li>\r\n <div className=\"project-entry\">\r\n <div className=\"project-team-name\">\r\n <NavLink to={`/${projects[index].id}`}>{projects[index].id}&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"project-status-info-container\">\r\n <div className=\"new-issues-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"bug\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Total issues</span>\r\n </div>\r\n <div className=\"issues-solved-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"check\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Issues solved</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Last updated: &nbsp;1 day ago</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"projectlist-title\">Your Projects</h2>\r\n <button className=\"create-new-project-button\">\r\n New Project\r\n </button>\r\n </div>\r\n <div className=\"project-sort-menu-container\">\r\n <div className=\"personal-shared-projects-container\">\r\n <a className={sharedProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={SharedProjectsButtonActive}>Shared Projects</a>\r\n <a className={personalProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={PersonalProjectsButtonActive}>Personal Projects</a>\r\n </div>\r\n <div className=\"project-sort-select-container\">\r\n <p>Sort by:</p>\r\n <select>\r\n <option>Last updated</option>\r\n <option>Last created</option>\r\n <option>Name</option>\r\n <option>Name descending</option>\r\n <option>Oldest created</option>\r\n <option>Oldest updated</option>\r\n </select>\r\n </div>\r\n </div>\r\n {sharedProjectsButtonState ? ProjectsDisplay(sharedProjects) : ProjectsDisplay(personalProjects)}\r\n </div >\r\n )\r\n}\r\n\r\nexport default ProjectOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.jsx",["121"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport \"./TeamInfo.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\n\r\nconst TeamInfo = () => {\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"teamInformationPage-content-header\">\r\n <div className=\"header-text\">\r\n <h2 className=\"teamInformationPage-title\">Henriks Meme machine > overview</h2>\r\n </div>\r\n <div className=\"header-notification-select-settings-button-container\">\r\n <div className=\"notification-button-container\">\r\n <button className={`notification-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"bell-icon\" icon=\"bell\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <a>\r\n <FontAwesomeIcon icon=\"user\"></FontAwesomeIcon>&nbsp;&nbsp;Account\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n <div className=\"settings-button-container\">\r\n <button>\r\n <FontAwesomeIcon icon=\"cog\"></FontAwesomeIcon>\r\n &nbsp;Settings\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"teamInformationPage-content-container\">\r\n {/*TODO: components goes here */}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default TeamInfo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.jsx",["122","123"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./TeamOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst TeamOverview = () => {\r\n\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"teamlist-title\">Teams</h2>\r\n <div className=\"buttons-container\">\r\n <button className=\"join-team-button\">\r\n Join Team\r\n </button>\r\n <button className=\"create-new-team-button\">\r\n New team\r\n </button>\r\n </div>\r\n </div>\r\n <div className=\"teamlist\">\r\n <ul>\r\n <li>\r\n <div className=\"team-entry\">\r\n <div className=\"image-team-name\">\r\n <NavLink to=\"/HenriksMemeMachine\" className=\"team-image-container\">\r\n <FontAwesomeIcon className=\"team-icon\" icon=\"dice-d6\"></FontAwesomeIcon>\r\n </NavLink>\r\n <NavLink to=\"/HenriksMemeMachine\">Henriks meme machine - ReactApp&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"team-status-info-container\">\r\n <div className=\"new-messages-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"envelope\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">New messages</span>\r\n </div>\r\n <div className=\"projects-maintained-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"project-diagram\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Projects maintained</span>\r\n </div>\r\n <div className=\"team-members-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"users\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Team members</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Date created: &nbsp;21/ 07/ 2021</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default TeamOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.jsx",["124","125","126","127","128","129"],"import React, { useState } from 'react'\r\nimport \"./Assign.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst Assign = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n\r\n const rootDirectoryObjects = [\r\n { id: \"Personal projects\" },\r\n { id: \"Shared projects\" }\r\n ]\r\n\r\n const DirectoryItems = () => {\r\n return (\r\n <div className=\"multi-level\">\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"A\" />\r\n <label for=\"A\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[0].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {personalProjects.map((elements, index) => (\r\n <li className=\"personalProjectsItem\">\r\n <input type=\"checkbox\" id={`A-${index}`} />\r\n <label for={`A-${index}`}>\r\n <FontAwesomeIcon icon=\"angle-right\" className=\"project-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {personalProjects[index].id} &nbsp;</a>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"B\" />\r\n <label for=\"B\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[1].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects.map((elements, index) => (\r\n <li><div className=\"sub-item\">\r\n <input type=\"checkbox\" id={`B-${index}`} />\r\n <label for={`B-${index}`}>\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {sharedProjects[index].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects[index].teams.map(team => (\r\n <li><div className=\"team-item\">\r\n <input type=\"checkbox\" id={`team-${team.name}`} />\r\n <label for={`team-${team.name}`}>\r\n <FontAwesomeIcon icon=\"users\" className=\"users-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {team.name} &nbsp;</a>\r\n </label>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"assignSelectContainer\">\r\n <DirectoryItems />\r\n </div >\r\n )\r\n}\r\n\r\nexport default Assign","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.jsx",["130","131","132","133"],"import React from 'react'\r\nimport \"./Updates.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport useMessages from '../../../util/useMessages'\r\n\r\nconst Updates = () => {\r\n const messages = useMessages()\r\n\r\n return (\r\n <div className=\"project-updates-new-messages-container\">\r\n\r\n <div className=\"project-updates-display-container\">\r\n <div className=\"project-updates-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"exclamation\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New project updates\r\n </p>\r\n </div>\r\n <div className=\"project-updates-display-content\">\r\n <div className=\"project-update-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [project] [new issues] [issues fixed]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"new-messages-display-container\">\r\n <div className=\"new-messages-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New messages\r\n </p>\r\n </div>\r\n {messages ? messages.map((message) => (\r\n <div className=\"new-messages-display-content\">\r\n <div className=\"new-message-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [{message.sender}] [{message.id}]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [{message.date}]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n )) : \"Loading messages\"}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Updates","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.jsx",["134","135","136","137"],"import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport React from 'react'\r\nimport \"./ActivitiesDisplay.css\"\r\n\r\nconst ActivitiesDisplay = () => {\r\n return (\r\n <div className=\"activity-new-issues-display-container\">\r\n\r\n <div className=\"new-issues-display-container\">\r\n <div className=\"new-issues-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"inbox\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New issue reports\r\n </p>\r\n </div>\r\n <div className=\"new-issues-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Severity] [type]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"activity-display-container\">\r\n <div className=\"activity-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"sticky-note\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Recent Team activities\r\n </p>\r\n </div>\r\n <div className=\"activity-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Name] [action]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ActivitiesDisplay","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.jsx",["138"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.jsx",["139","140"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./Logo.css\"\r\nimport logo_picture from \"../../../images/bird-logo.jpg\"\r\nimport logo_text from \"../../../images/logo-text.jpg\"\r\n\r\nconst Logo = () => {\r\n return (\r\n <h1 className=\"title\">\r\n <span className=\"title-icon\">\r\n <NavLink to=\"/home\" id=\"logo\">\r\n <img src={logo_picture} width=\"24\" height=\"24\"></img>\r\n <img src={logo_text} width=\"48\" height=\"24\"></img>\r\n </NavLink>\r\n </span>\r\n </h1>\r\n )\r\n}\r\n\r\nexport default Logo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.jsx",["141"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./NavbarDropdownMenu.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\n\r\nconst DropdownMenu = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const logout = () => {\r\n oktaAuth.signOut()\r\n }\r\n\r\n return (\r\n <li>\r\n <div className=\"navbar-user-dropdown-container\">\r\n <button className={`user-dropdown-menu-toggle-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"user-icon\" icon=\"user-circle\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n {/* show submenu?*/}\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <NavLink to=\"/account\" onClick={onClick} className=\"top-item\">\r\n <div>\r\n <FontAwesomeIcon icon=\"user\" className=\"item-icon-top\"></FontAwesomeIcon>&nbsp;&nbsp;\r\n </div>\r\n <div className=\"item-top-text\">\r\n <span>\r\n <p className=\"top-row\">Account</p>\r\n <p className=\"bottom-row\">{userInfo ? userInfo.email : \"...\"}</p>\r\n </span>\r\n </div>\r\n <div className=\"item-last-flex-item\">\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"item-icon-top\"></FontAwesomeIcon>\r\n </div>\r\n </NavLink>\r\n </li>\r\n <li>\r\n <NavLink to=\"/messages\" onClick={onClick}>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>&nbsp;&nbsp;Messages\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </NavLink>\r\n </li>\r\n {/* <li>\r\n <a href=\"./\">\r\n <FontAwesomeIcon icon=\"sliders-h\"></FontAwesomeIcon>&nbsp;&nbsp;Preferences\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li> */}\r\n <li>\r\n <a onClick={logout}>\r\n <FontAwesomeIcon icon=\"sign-out-alt\"></FontAwesomeIcon>&nbsp;&nbsp;Log out\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </li >\r\n )\r\n}\r\n\r\nexport default DropdownMenu","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.jsx",[],{"ruleId":"142","replacedBy":"143"},{"ruleId":"144","replacedBy":"145"},{"ruleId":"146","severity":1,"message":"147","line":1,"column":1,"nodeType":"148","endLine":14,"endColumn":3},{"ruleId":"149","severity":1,"message":"150","line":47,"column":6,"nodeType":"151","endLine":47,"endColumn":17,"suggestions":"152"},{"ruleId":"142","replacedBy":"153"},{"ruleId":"144","replacedBy":"154"},{"ruleId":"155","severity":1,"message":"156","line":6,"column":10,"nodeType":"157","messageId":"158","endLine":6,"endColumn":17},{"ruleId":"149","severity":1,"message":"159","line":43,"column":6,"nodeType":"151","endLine":43,"endColumn":33,"suggestions":"160"},{"ruleId":"161","severity":1,"message":"162","line":75,"column":20,"nodeType":"163","messageId":"164","endLine":75,"endColumn":22},{"ruleId":"161","severity":1,"message":"162","line":134,"column":19,"nodeType":"163","messageId":"164","endLine":134,"endColumn":21},{"ruleId":"165","severity":1,"message":"166","line":243,"column":15,"nodeType":"167","endLine":243,"endColumn":48},{"ruleId":"155","severity":1,"message":"168","line":1,"column":17,"nodeType":"157","messageId":"158","endLine":1,"endColumn":25},{"ruleId":"165","severity":1,"message":"166","line":75,"column":11,"nodeType":"167","endLine":75,"endColumn":123},{"ruleId":"165","severity":1,"message":"166","line":76,"column":11,"nodeType":"167","endLine":76,"endColumn":127},{"ruleId":"165","severity":1,"message":"166","line":43,"column":19,"nodeType":"167","endLine":43,"endColumn":22},{"ruleId":"155","severity":1,"message":"169","line":8,"column":9,"nodeType":"157","messageId":"158","endLine":8,"endColumn":25},{"ruleId":"155","severity":1,"message":"170","line":13,"column":9,"nodeType":"157","messageId":"158","endLine":13,"endColumn":23},{"ruleId":"155","severity":1,"message":"168","line":1,"column":17,"nodeType":"157","messageId":"158","endLine":1,"endColumn":25},{"ruleId":"165","severity":1,"message":"166","line":29,"column":13,"nodeType":"167","endLine":29,"endColumn":16},{"ruleId":"165","severity":1,"message":"166","line":39,"column":19,"nodeType":"167","endLine":39,"endColumn":22},{"ruleId":"165","severity":1,"message":"166","line":50,"column":13,"nodeType":"167","endLine":50,"endColumn":16},{"ruleId":"165","severity":1,"message":"166","line":60,"column":19,"nodeType":"167","endLine":60,"endColumn":22},{"ruleId":"165","severity":1,"message":"166","line":70,"column":25,"nodeType":"167","endLine":70,"endColumn":28},{"ruleId":"165","severity":1,"message":"166","line":23,"column":17,"nodeType":"167","endLine":23,"endColumn":20},{"ruleId":"165","severity":1,"message":"166","line":28,"column":17,"nodeType":"167","endLine":28,"endColumn":20},{"ruleId":"165","severity":1,"message":"166","line":52,"column":19,"nodeType":"167","endLine":52,"endColumn":22},{"ruleId":"165","severity":1,"message":"166","line":57,"column":19,"nodeType":"167","endLine":57,"endColumn":22},{"ruleId":"165","severity":1,"message":"166","line":20,"column":17,"nodeType":"167","endLine":20,"endColumn":20},{"ruleId":"165","severity":1,"message":"166","line":25,"column":17,"nodeType":"167","endLine":25,"endColumn":20},{"ruleId":"165","severity":1,"message":"166","line":48,"column":17,"nodeType":"167","endLine":48,"endColumn":20},{"ruleId":"165","severity":1,"message":"166","line":53,"column":17,"nodeType":"167","endLine":53,"endColumn":20},{"ruleId":"155","severity":1,"message":"171","line":10,"column":22,"nodeType":"157","messageId":"158","endLine":10,"endColumn":30},{"ruleId":"172","severity":1,"message":"173","line":12,"column":11,"nodeType":"167","endLine":12,"endColumn":58},{"ruleId":"172","severity":1,"message":"173","line":13,"column":11,"nodeType":"167","endLine":13,"endColumn":55},{"ruleId":"165","severity":1,"message":"166","line":88,"column":15,"nodeType":"167","endLine":88,"endColumn":35},"no-native-reassign",["174"],"no-negated-in-lhs",["175"],"import/no-anonymous-default-export","Assign object to a variable before exporting as module default","ExportDefaultDeclaration","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'oktaAuth'. Either include it or remove the dependency array.","ArrayExpression",["176"],["174"],["175"],"no-unused-vars","'NavLink' is defined but never used.","Identifier","unusedVar","React Hook useEffect has a missing dependency: 'toggleSignInFormVisible'. Either include it or remove the dependency array.",["177"],"eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","jsx-a11y/anchor-is-valid","The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","'useState' is defined but never used.","'personalProjects' is assigned a value but never used.","'sharedProjects' is assigned a value but never used.","'oktaAuth' is assigned a value but never used.","jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","no-global-assign","no-unsafe-negation",{"desc":"178","fix":"179"},{"desc":"180","fix":"181"},"Update the dependencies array to be: [authState, oktaAuth]",{"range":"182","text":"183"},"Update the dependencies array to be: [signUpFormVisibilityState, toggleSignInFormVisible]",{"range":"184","text":"185"},[1422,1433],"[authState, oktaAuth]",[1553,1580],"[signUpFormVisibilityState, toggleSignInFormVisible]"]
\ No newline at end of file
[{"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js":"1","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.jsx":"2","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js":"3","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.jsx":"4","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useInput.jsx":"5","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.jsx":"6","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.jsx":"7","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.jsx":"8","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.jsx":"9","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.jsx":"10","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.jsx":"11","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.jsx":"12","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.jsx":"13","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.jsx":"14","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.jsx":"15","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.jsx":"16","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.jsx":"17","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.jsx":"18","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.jsx":"19","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.jsx":"20","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.jsx":"21","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.jsx":"22","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.jsx":"23","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.jsx":"24"},{"size":285,"mtime":1628516023915,"results":"25","hashOfConfig":"26"},{"size":2100,"mtime":1630074941213,"results":"27","hashOfConfig":"26"},{"size":473,"mtime":1629901058454,"results":"28","hashOfConfig":"26"},{"size":1489,"mtime":1629790769379,"results":"29","hashOfConfig":"26"},{"size":324,"mtime":1629371594261,"results":"30","hashOfConfig":"26"},{"size":3379,"mtime":1630094426455,"results":"31","hashOfConfig":"26"},{"size":626,"mtime":1628697746462,"results":"32","hashOfConfig":"26"},{"size":3967,"mtime":1628695632288,"results":"33","hashOfConfig":"26"},{"size":1279,"mtime":1630089091700,"results":"34","hashOfConfig":"26"},{"size":1068,"mtime":1628696051327,"results":"35","hashOfConfig":"26"},{"size":3660,"mtime":1629794572456,"results":"36","hashOfConfig":"26"},{"size":2374,"mtime":1628696187694,"results":"37","hashOfConfig":"26"},{"size":2694,"mtime":1628696113184,"results":"38","hashOfConfig":"26"},{"size":3264,"mtime":1628535700010,"results":"39","hashOfConfig":"26"},{"size":2334,"mtime":1630060568411,"results":"40","hashOfConfig":"26"},{"size":2096,"mtime":1628430812599,"results":"41","hashOfConfig":"26"},{"size":3570,"mtime":1628430832688,"results":"42","hashOfConfig":"26"},{"size":906,"mtime":1630073002522,"results":"43","hashOfConfig":"26"},{"size":548,"mtime":1628421916010,"results":"44","hashOfConfig":"26"},{"size":697,"mtime":1628430740299,"results":"45","hashOfConfig":"26"},{"size":470,"mtime":1628430752153,"results":"46","hashOfConfig":"26"},{"size":3533,"mtime":1630069281308,"results":"47","hashOfConfig":"26"},{"size":4009,"mtime":1630090234456,"results":"48","hashOfConfig":"26"},{"size":4940,"mtime":1630094755661,"results":"49","hashOfConfig":"26"},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},"iyhzrm",{"filePath":"53","messages":"54","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"55","messages":"56","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"57","usedDeprecatedRules":"52"},{"filePath":"58","messages":"59","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"60","usedDeprecatedRules":"52"},{"filePath":"61","messages":"62","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"63"},{"filePath":"64","messages":"65","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"66","messages":"67","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"68","messages":"69","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"70","usedDeprecatedRules":"52"},{"filePath":"71","messages":"72","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"73","messages":"74","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"75","messages":"76","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"77","usedDeprecatedRules":"52"},{"filePath":"78","messages":"79","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"80","usedDeprecatedRules":"52"},{"filePath":"81","messages":"82","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"83","usedDeprecatedRules":"52"},{"filePath":"84","messages":"85","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"86","usedDeprecatedRules":"52"},{"filePath":"87","messages":"88","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"89","usedDeprecatedRules":"52"},{"filePath":"90","messages":"91","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"92","usedDeprecatedRules":"52"},{"filePath":"93","messages":"94","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"95","messages":"96","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"97","usedDeprecatedRules":"52"},{"filePath":"98","messages":"99","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"100","usedDeprecatedRules":"52"},{"filePath":"101","messages":"102","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"103","messages":"104","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"105","messages":"106","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"107","usedDeprecatedRules":"52"},{"filePath":"108","messages":"109","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"110","messages":"111","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js",[],["112","113"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js",["114"],"export default {\r\n oidc: {\r\n clientId: '0oa1f4zfeiiZPB6DF5d7',\r\n issuer: 'https://dev-91882654.okta.com/oauth2/default',\r\n redirectUri: window.location.origin + '/login/callback',\r\n scopes: ['openid', 'profile', 'email'],\r\n pkce: true\r\n },\r\n serviceAPI: {\r\n messagesURL: 'http://localhost:3030/api/messages',\r\n createNewUserURL: 'http://localhost:3030/api/create-user',\r\n resetPasswordURL: 'http://localhost:3030/api/reset-user-password'\r\n }\r\n};","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.jsx",["115"],"import { useState, useEffect } from 'react';\r\nimport { useOktaAuth } from '@okta/okta-react';\r\n\r\nimport config from \"../config\"\r\n\r\nconst useMessages = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [messages, setMessages] = useState(null);\r\n\r\n // fetch messages\r\n useEffect(() => {\r\n if (authState && authState.isAuthenticated) {\r\n const accessToken = oktaAuth.getAccessToken();\r\n fetch(config.serviceAPI.messagesURL, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n })\r\n .then((response) => {\r\n if (!response.ok) {\r\n return Promise.reject();\r\n }\r\n return response.json();\r\n })\r\n .then((data) => {\r\n let index = 0;\r\n const formattedMessages = data.messages.map((message) => {\r\n const date = new Date(message.date);\r\n const day = date.toLocaleDateString();\r\n const time = date.toLocaleTimeString();\r\n index += 1;\r\n return {\r\n date: `${day} ${time}`,\r\n sender: message.sender,\r\n text: message.text,\r\n id: `message-${index}`,\r\n };\r\n });\r\n setMessages(formattedMessages);\r\n })\r\n .catch((err) => {\r\n /* eslint-disable no-console */\r\n console.error(err);\r\n });\r\n }\r\n }, [authState]);\r\n\r\n return messages\r\n}\r\n\r\nexport default useMessages","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useInput.jsx",[],["116","117"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.jsx",["118","119","120","121","122","123","124"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.jsx",["125"],"import React, { useState } from 'react'\r\nimport \"./ReportForm.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Assign from './assign/Assign'\r\n\r\nconst ReportForm = () => {\r\n return (\r\n <div className=\"page-content-container\">\r\n <h2 className=\"reportissuePageText\">Report an issue</h2>\r\n <form action=\"/reportFormData\">\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueType\">Type of issue</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueType\" className=\"issueType\">\r\n <option value=\"bug\">Bug</option>\r\n <option value=\"usabilityissue\">Usability error</option>\r\n <option value=\"other\">Other</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueLocation\">Where did you encounter the issue?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <input type=\"text\" id=\"fissueLocation\" className=\"issueLocation\" ></input>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueDescription\">Describe the issue</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueDescription\" className=\"issueDescription\"></textarea>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueStepsToTeproduce\">What steps did you take before the issue happened?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueStepsToTeproduce\" className=\"issueStepsToReproduce\"\r\n placeholder=\"List the steps that occurred before the issue happened:\r\n1.\r\n2.\r\n3.\r\nExpected Result:\r\nActual Result:\">\r\n </textarea>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueSeverity\">Severity level</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueSeverity\">\r\n <option value=\"cosmetic\">Cosmetic - should be corrected when time permits</option>\r\n <option value=\"serious\">Serious - should be corrected in the next release</option>\r\n <option value=\"critical\">Critical - should be corrected as soon as possible</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueTimeToCorrect\">Time to Correct</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueTimeToCorrect\">\r\n <option value=\"lessThanTwoHours\">Less than 2 minutes</option>\r\n <option value=\"lessThanOneToTwoDays\">Less than 1 or 2 days</option>\r\n <option value=\"lessThanOneToTwoWeeks\">Less than 1 or 2 weeks</option>\r\n <option value=\"atLeastTwoWeeks\">More than 2 weeks</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueAssignToProject\">Assign to</label>\r\n </div>\r\n <div className=\"col-75\">\r\n {/*\r\n <select id=\"fissueAssignToProject\" className=\"issueAssignToProject\">\r\n <option value=\"lessThanTwoHours\">Henriks meme machine - ReactApp</option>\r\n </select>\r\n */}\r\n <Assign />\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row\">\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </div>\r\n </form>\r\n </div >\r\n )\r\n}\r\n\r\nexport default ReportForm","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.jsx",["126","127"],"import React, { useState } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport \"./ProjectOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst ProjectOverview = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n const [sharedProjectsButtonState, setSharedProjectsButtonState] = useState(true);\r\n const [personalProjectsButtonState, setPersonalProjectsButtonState] = useState(false);\r\n\r\n const SharedProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(true);\r\n setPersonalProjectsButtonState(false);\r\n };\r\n\r\n const PersonalProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(false);\r\n setPersonalProjectsButtonState(true);\r\n };\r\n\r\n const ProjectsDisplay = (projects) => {\r\n return (\r\n <div className=\"projectlist\">\r\n <ul>\r\n {projects.map((elements, index) => (\r\n <li>\r\n <div className=\"project-entry\">\r\n <div className=\"project-team-name\">\r\n <NavLink to={`/${projects[index].id}`}>{projects[index].id}&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"project-status-info-container\">\r\n <div className=\"new-issues-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"bug\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Total issues</span>\r\n </div>\r\n <div className=\"issues-solved-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"check\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Issues solved</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Last updated: &nbsp;1 day ago</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"projectlist-title\">Your Projects</h2>\r\n <button className=\"create-new-project-button\">\r\n New Project\r\n </button>\r\n </div>\r\n <div className=\"project-sort-menu-container\">\r\n <div className=\"personal-shared-projects-container\">\r\n <a className={sharedProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={SharedProjectsButtonActive}>Shared Projects</a>\r\n <a className={personalProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={PersonalProjectsButtonActive}>Personal Projects</a>\r\n </div>\r\n <div className=\"project-sort-select-container\">\r\n <p>Sort by:</p>\r\n <select>\r\n <option>Last updated</option>\r\n <option>Last created</option>\r\n <option>Name</option>\r\n <option>Name descending</option>\r\n <option>Oldest created</option>\r\n <option>Oldest updated</option>\r\n </select>\r\n </div>\r\n </div>\r\n {sharedProjectsButtonState ? ProjectsDisplay(sharedProjects) : ProjectsDisplay(personalProjects)}\r\n </div >\r\n )\r\n}\r\n\r\nexport default ProjectOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.jsx",["128"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport \"./TeamInfo.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\n\r\nconst TeamInfo = () => {\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"teamInformationPage-content-header\">\r\n <div className=\"header-text\">\r\n <h2 className=\"teamInformationPage-title\">Henriks Meme machine > overview</h2>\r\n </div>\r\n <div className=\"header-notification-select-settings-button-container\">\r\n <div className=\"notification-button-container\">\r\n <button className={`notification-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"bell-icon\" icon=\"bell\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <a>\r\n <FontAwesomeIcon icon=\"user\"></FontAwesomeIcon>&nbsp;&nbsp;Account\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n <div className=\"settings-button-container\">\r\n <button>\r\n <FontAwesomeIcon icon=\"cog\"></FontAwesomeIcon>\r\n &nbsp;Settings\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"teamInformationPage-content-container\">\r\n {/*TODO: components goes here */}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default TeamInfo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.jsx",["129","130"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./TeamOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst TeamOverview = () => {\r\n\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"teamlist-title\">Teams</h2>\r\n <div className=\"buttons-container\">\r\n <button className=\"join-team-button\">\r\n Join Team\r\n </button>\r\n <button className=\"create-new-team-button\">\r\n New team\r\n </button>\r\n </div>\r\n </div>\r\n <div className=\"teamlist\">\r\n <ul>\r\n <li>\r\n <div className=\"team-entry\">\r\n <div className=\"image-team-name\">\r\n <NavLink to=\"/HenriksMemeMachine\" className=\"team-image-container\">\r\n <FontAwesomeIcon className=\"team-icon\" icon=\"dice-d6\"></FontAwesomeIcon>\r\n </NavLink>\r\n <NavLink to=\"/HenriksMemeMachine\">Henriks meme machine - ReactApp&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"team-status-info-container\">\r\n <div className=\"new-messages-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"envelope\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">New messages</span>\r\n </div>\r\n <div className=\"projects-maintained-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"project-diagram\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Projects maintained</span>\r\n </div>\r\n <div className=\"team-members-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"users\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Team members</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Date created: &nbsp;21/ 07/ 2021</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default TeamOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.jsx",["131","132","133","134","135","136"],"import React, { useState } from 'react'\r\nimport \"./Assign.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst Assign = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n\r\n const rootDirectoryObjects = [\r\n { id: \"Personal projects\" },\r\n { id: \"Shared projects\" }\r\n ]\r\n\r\n const DirectoryItems = () => {\r\n return (\r\n <div className=\"multi-level\">\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"A\" />\r\n <label for=\"A\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[0].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {personalProjects.map((elements, index) => (\r\n <li className=\"personalProjectsItem\">\r\n <input type=\"checkbox\" id={`A-${index}`} />\r\n <label for={`A-${index}`}>\r\n <FontAwesomeIcon icon=\"angle-right\" className=\"project-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {personalProjects[index].id} &nbsp;</a>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"B\" />\r\n <label for=\"B\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[1].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects.map((elements, index) => (\r\n <li><div className=\"sub-item\">\r\n <input type=\"checkbox\" id={`B-${index}`} />\r\n <label for={`B-${index}`}>\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {sharedProjects[index].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects[index].teams.map(team => (\r\n <li><div className=\"team-item\">\r\n <input type=\"checkbox\" id={`team-${team.name}`} />\r\n <label for={`team-${team.name}`}>\r\n <FontAwesomeIcon icon=\"users\" className=\"users-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {team.name} &nbsp;</a>\r\n </label>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"assignSelectContainer\">\r\n <DirectoryItems />\r\n </div >\r\n )\r\n}\r\n\r\nexport default Assign","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.jsx",["137","138","139","140"],"import React from 'react'\r\nimport \"./Updates.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport useMessages from '../../../util/useMessages'\r\n\r\nconst Updates = () => {\r\n const messages = useMessages()\r\n\r\n return (\r\n <div className=\"project-updates-new-messages-container\">\r\n\r\n <div className=\"project-updates-display-container\">\r\n <div className=\"project-updates-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"exclamation\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New project updates\r\n </p>\r\n </div>\r\n <div className=\"project-updates-display-content\">\r\n <div className=\"project-update-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [project] [new issues] [issues fixed]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"new-messages-display-container\">\r\n <div className=\"new-messages-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New messages\r\n </p>\r\n </div>\r\n {messages ? messages.map((message) => (\r\n <div className=\"new-messages-display-content\">\r\n <div className=\"new-message-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [{message.sender}] [{message.id}]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [{message.date}]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n )) : \"Loading messages\"}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Updates","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.jsx",["141","142","143","144"],"import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport React from 'react'\r\nimport \"./ActivitiesDisplay.css\"\r\n\r\nconst ActivitiesDisplay = () => {\r\n return (\r\n <div className=\"activity-new-issues-display-container\">\r\n\r\n <div className=\"new-issues-display-container\">\r\n <div className=\"new-issues-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"inbox\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New issue reports\r\n </p>\r\n </div>\r\n <div className=\"new-issues-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Severity] [type]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"activity-display-container\">\r\n <div className=\"activity-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"sticky-note\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Recent Team activities\r\n </p>\r\n </div>\r\n <div className=\"activity-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Name] [action]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ActivitiesDisplay","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.jsx",["145"],"import React from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Navbar.css\"\r\nimport Logo from './logo/Logo'\r\nimport NavLinks from './navLinks/NavLinks'\r\nimport Searchbar from './searchbar/Searchbar'\r\nimport NavbarDropdownMenu from './dropdownMenu/NavbarDropdownMenu'\r\n\r\nconst Navbar = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div className=\"navbar\" >\r\n <div className=\"header-content\">\r\n <div className=\"title-navigation-links-container\">\r\n <Logo />\r\n <NavLinks />\r\n </div>\r\n <div className=\"searchbar-profile-container\">\r\n <ul className=\"right-unstyled-navbar\">\r\n <Searchbar />\r\n <NavbarDropdownMenu />\r\n </ul>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default Navbar","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.jsx",["146","147"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./Logo.css\"\r\nimport logo_picture from \"../../../images/bird-logo.jpg\"\r\nimport logo_text from \"../../../images/logo-text.jpg\"\r\n\r\nconst Logo = () => {\r\n return (\r\n <h1 className=\"title\">\r\n <span className=\"title-icon\">\r\n <NavLink to=\"/home\" id=\"logo\">\r\n <img src={logo_picture} width=\"24\" height=\"24\"></img>\r\n <img src={logo_text} width=\"48\" height=\"24\"></img>\r\n </NavLink>\r\n </span>\r\n </h1>\r\n )\r\n}\r\n\r\nexport default Logo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.jsx",["148"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./NavbarDropdownMenu.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\n\r\nconst DropdownMenu = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const logout = () => {\r\n oktaAuth.signOut()\r\n }\r\n\r\n return (\r\n <li>\r\n <div className=\"navbar-user-dropdown-container\">\r\n <button className={`user-dropdown-menu-toggle-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"user-icon\" icon=\"user-circle\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n {/* show submenu?*/}\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <NavLink to=\"/account\" onClick={onClick} className=\"top-item\">\r\n <div>\r\n <FontAwesomeIcon icon=\"user\" className=\"item-icon-top\"></FontAwesomeIcon>&nbsp;&nbsp;\r\n </div>\r\n <div className=\"item-top-text\">\r\n <span>\r\n <p className=\"top-row\">Account</p>\r\n <p className=\"bottom-row\">{userInfo ? userInfo.email : \"...\"}</p>\r\n </span>\r\n </div>\r\n <div className=\"item-last-flex-item\">\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"item-icon-top\"></FontAwesomeIcon>\r\n </div>\r\n </NavLink>\r\n </li>\r\n <li>\r\n <NavLink to=\"/messages\" onClick={onClick}>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>&nbsp;&nbsp;Messages\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </NavLink>\r\n </li>\r\n {/* <li>\r\n <a href=\"./\">\r\n <FontAwesomeIcon icon=\"sliders-h\"></FontAwesomeIcon>&nbsp;&nbsp;Preferences\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li> */}\r\n <li>\r\n <a onClick={logout}>\r\n <FontAwesomeIcon icon=\"sign-out-alt\"></FontAwesomeIcon>&nbsp;&nbsp;Log out\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </li >\r\n )\r\n}\r\n\r\nexport default DropdownMenu","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.jsx",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.jsx",["149","150"],{"ruleId":"151","replacedBy":"152"},{"ruleId":"153","replacedBy":"154"},{"ruleId":"155","severity":1,"message":"156","line":1,"column":1,"nodeType":"157","endLine":14,"endColumn":3},{"ruleId":"158","severity":1,"message":"159","line":47,"column":6,"nodeType":"160","endLine":47,"endColumn":17,"suggestions":"161"},{"ruleId":"151","replacedBy":"162"},{"ruleId":"153","replacedBy":"163"},{"ruleId":"164","severity":1,"message":"165","line":1,"column":27,"nodeType":"166","messageId":"167","endLine":1,"endColumn":36},{"ruleId":"164","severity":1,"message":"168","line":1,"column":38,"nodeType":"166","messageId":"167","endLine":1,"endColumn":44},{"ruleId":"164","severity":1,"message":"169","line":6,"column":10,"nodeType":"166","messageId":"167","endLine":6,"endColumn":17},{"ruleId":"164","severity":1,"message":"170","line":7,"column":8,"nodeType":"166","messageId":"167","endLine":7,"endColumn":14},{"ruleId":"164","severity":1,"message":"171","line":31,"column":9,"nodeType":"166","messageId":"167","endLine":31,"endColumn":28},{"ruleId":"172","severity":1,"message":"173","line":60,"column":19,"nodeType":"174","messageId":"175","endLine":60,"endColumn":21},{"ruleId":"176","severity":1,"message":"177","line":107,"column":15,"nodeType":"178","endLine":107,"endColumn":48},{"ruleId":"164","severity":1,"message":"179","line":1,"column":17,"nodeType":"166","messageId":"167","endLine":1,"endColumn":25},{"ruleId":"176","severity":1,"message":"177","line":75,"column":11,"nodeType":"178","endLine":75,"endColumn":123},{"ruleId":"176","severity":1,"message":"177","line":76,"column":11,"nodeType":"178","endLine":76,"endColumn":127},{"ruleId":"176","severity":1,"message":"177","line":43,"column":19,"nodeType":"178","endLine":43,"endColumn":22},{"ruleId":"164","severity":1,"message":"180","line":8,"column":9,"nodeType":"166","messageId":"167","endLine":8,"endColumn":25},{"ruleId":"164","severity":1,"message":"181","line":13,"column":9,"nodeType":"166","messageId":"167","endLine":13,"endColumn":23},{"ruleId":"164","severity":1,"message":"179","line":1,"column":17,"nodeType":"166","messageId":"167","endLine":1,"endColumn":25},{"ruleId":"176","severity":1,"message":"177","line":29,"column":13,"nodeType":"178","endLine":29,"endColumn":16},{"ruleId":"176","severity":1,"message":"177","line":39,"column":19,"nodeType":"178","endLine":39,"endColumn":22},{"ruleId":"176","severity":1,"message":"177","line":50,"column":13,"nodeType":"178","endLine":50,"endColumn":16},{"ruleId":"176","severity":1,"message":"177","line":60,"column":19,"nodeType":"178","endLine":60,"endColumn":22},{"ruleId":"176","severity":1,"message":"177","line":70,"column":25,"nodeType":"178","endLine":70,"endColumn":28},{"ruleId":"176","severity":1,"message":"177","line":23,"column":17,"nodeType":"178","endLine":23,"endColumn":20},{"ruleId":"176","severity":1,"message":"177","line":28,"column":17,"nodeType":"178","endLine":28,"endColumn":20},{"ruleId":"176","severity":1,"message":"177","line":52,"column":19,"nodeType":"178","endLine":52,"endColumn":22},{"ruleId":"176","severity":1,"message":"177","line":57,"column":19,"nodeType":"178","endLine":57,"endColumn":22},{"ruleId":"176","severity":1,"message":"177","line":20,"column":17,"nodeType":"178","endLine":20,"endColumn":20},{"ruleId":"176","severity":1,"message":"177","line":25,"column":17,"nodeType":"178","endLine":25,"endColumn":20},{"ruleId":"176","severity":1,"message":"177","line":48,"column":17,"nodeType":"178","endLine":48,"endColumn":20},{"ruleId":"176","severity":1,"message":"177","line":53,"column":17,"nodeType":"178","endLine":53,"endColumn":20},{"ruleId":"164","severity":1,"message":"182","line":10,"column":22,"nodeType":"166","messageId":"167","endLine":10,"endColumn":30},{"ruleId":"183","severity":1,"message":"184","line":12,"column":11,"nodeType":"178","endLine":12,"endColumn":58},{"ruleId":"183","severity":1,"message":"184","line":13,"column":11,"nodeType":"178","endLine":13,"endColumn":55},{"ruleId":"176","severity":1,"message":"177","line":88,"column":15,"nodeType":"178","endLine":88,"endColumn":35},{"ruleId":"158","severity":1,"message":"185","line":27,"column":6,"nodeType":"160","endLine":27,"endColumn":33,"suggestions":"186"},{"ruleId":"172","severity":1,"message":"173","line":80,"column":20,"nodeType":"174","messageId":"175","endLine":80,"endColumn":22},"no-native-reassign",["187"],"no-negated-in-lhs",["188"],"import/no-anonymous-default-export","Assign object to a variable before exporting as module default","ExportDefaultDeclaration","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'oktaAuth'. Either include it or remove the dependency array.","ArrayExpression",["189"],["187"],["188"],"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'useRef' is defined but never used.","'NavLink' is defined but never used.","'signUp' is defined but never used.","'loginRequestOptions' is assigned a value but never used.","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","jsx-a11y/anchor-is-valid","The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","'useState' is defined but never used.","'personalProjects' is assigned a value but never used.","'sharedProjects' is assigned a value but never used.","'oktaAuth' is assigned a value but never used.","jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","React Hook useEffect has a missing dependency: 'toggleSignUpFormVisible'. Either include it or remove the dependency array.",["190"],"no-global-assign","no-unsafe-negation",{"desc":"191","fix":"192"},{"desc":"193","fix":"194"},"Update the dependencies array to be: [authState, oktaAuth]",{"range":"195","text":"196"},"Update the dependencies array to be: [signUpFormVisibilityState, toggleSignUpFormVisible]",{"range":"197","text":"198"},[1422,1433],"[authState, oktaAuth]",[873,900],"[signUpFormVisibilityState, toggleSignUpFormVisible]"]
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n console.log(\"Remove eventlistener\");\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 131,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 129,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 136,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 145,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 143,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 128,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 150,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 149,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 148,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 157,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"wrhmVp2lhpyin9y/fggBjGZq26c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","Login","authState","oktaAuth","sessionToken","setSessionToken","toggleSignInFormVisible","showSignUpForm","signUpFormVisibilityState","username","setUsername","password","setPassword","pageClickEvent","e","console","log","signUpFormRef","current","contains","target","window","addEventListener","removeEventListener","userInputData","JSON","stringify","firstname","lastname","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","handlefirstnameChange","setfirstname","value","handlelastnameChange","setlastname","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","setConfirmPassword","handlePasswordReset","fetch","config","serviceAPI","resetPasswordURL","ok","alert","Promise","reject","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,YAAD,EAAeC,eAAf,IAAkCZ,QAAQ,EAAhD;;AACA,QAAMa,uBAAuB,GAAG,MAAMC,cAAc,CAAC,CAACC,yBAAF,CAApD;;AAEA,QAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BjB,QAAQ,CAAC,EAAD,CAAxC;AACA,QAAM,CAACkB,QAAD,EAAWC,WAAX,IAA0BnB,QAAQ,CAAC,EAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMmB,cAAc,GAAIC,CAAD,IAAO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ExC,yBAAyB,GAAG,IAAH,GAAUG,QAF5C;AAGE,cAAA,QAAQ,EAAEsC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEG,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAXF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA0CD,GA3CD,MA2CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CAtJD;;GAAMnD,K;UAC4BJ,W;;;KAD5BI,K;AAwJN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n console.log(\"Form visible: \" + signUpFormVisibilityState)\r\n toggleSignInFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n console.log(\"Add eventlistener\")\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n console.log(\"Remove eventlistener\")\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 83,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"u8yY6NlW4PSOG6xgLhGhaVL5lVE=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","handlePasswordReset","fetch","serviceAPI","resetPasswordURL","ok","window","alert","Promise","reject","isAuthenticated","toggleSignInFormVisible","signUpFormVisibilityState"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,YAAD,EAAeC,eAAf,IAAkCb,QAAQ,EAAhD;AAEA,QAAM,CAACc,QAAD,EAAWC,WAAX,IAA0Bf,QAAQ,CAAC,EAAD,CAAxC;AACA,QAAM,CAACgB,QAAD,EAAWC,WAAX,IAA0BjB,QAAQ,CAAC,EAAD,CAAxC;;AAEA,QAAMkB,oBAAoB,GAAIC,CAAD,IAAO;AAClCJ,IAAAA,WAAW,CAACI,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIA,QAAMC,oBAAoB,GAAIH,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIA,QAAME,aAAa,GAAGC,IAAI,CAACC,SAAL,CAAe;AACnCC,IAAAA,KAAK,EAAG,GAAEZ,QAAS,EADgB;AAEnCE,IAAAA,QAAQ,EAAG,GAAEA,QAAS;AAFa,GAAf,CAAtB;AAKA,QAAMW,mBAAmB,GAAG;AAC1BC,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AAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEoB,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAXF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA0CD,GA3CD,MA2CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CAjHD;;GAAMjC,K;UAC4BL,W;;;KAD5BK,K;AAmHN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n console.log(\"Remove eventlistener\");\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 125,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 134,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"wrhmVp2lhpyin9y/fggBjGZq26c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","pageClickEvent","e","console","log","signUpFormRef","current","contains","target","signUpFormVisibilityState","toggleSignInFormVisible","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","handlePasswordReset","fetch","config","serviceAPI","resetPasswordURL","ok","alert","Promise","reject","isAuthenticated","handleUsernameChange","handlePasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,YAAD,EAAeC,eAAf,IAAkCZ,QAAQ,EAAhD;AAEA,QAAM,CAACa,QA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AAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAXF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA0CD,GA3CD,MA2CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CA/HD;;GAAMvC,K;UAC4BJ,W;;;KAD5BI,K;AAiIN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n console.log(\"Form visible: \" + signUpFormVisibilityState)\r\n toggleSignInFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n console.log(\"Add eventlistener\")\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n console.log(\"Remove eventlistener\")\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// handleSignInFormSubmit(e)\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 128,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 83,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"X8Ck5qdBspERHliLS55/n2n2lgM=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","FontAwesomeIcon","config","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","toggleSignInFormVisible","loginRequestOptions","method","body","userInputData","JSON","stringify","firstname","lastname","email","username","password","setfirstname","setlastname","setUsername","setPassword","confirmPassword","setConfirmPassword","handlefirstnameChange","e","target","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","handleSignUpFormSubmit","preventDefault","window","alert","length","fetch","serviceAPI","createNewUserURL","then","res","ok","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CP,QAAQ,CAAC,KAAD,CAA5D;AACA,QAAMQ,aAAa,GAAGN,MAAM,CAAC,IAAD,CAA5B;;AACA,QAAMO,uBAAuB,GAAG,MAAMF,cAAc,CAAC,CAACD,yBAAF,CAApD;;AAEA,QAAMI,mBAAmB,GAAG;AAC1BC,IAAAA,MAAM,EAAE,MADkB;AAE1BC,IAAAA,IAAI,EAAEC;AAFoB,GAA5B;AAKA,QAAMA,aAAa,GAAGC,IAAI,CAACC,SAAL,CAAe;AACnCC,IAAAA,SAAS,EAAG,GAAEA,SAAU,EADW;AAEnCC,IAAAA,QAAQ,EAAG,GAAEA,QAAS,EAFa;AAGnCC,IAAAA,KAAK,EAAG,GAAEC,QAAS,EAHgB;AAInCC,IAAAA,QAAQ,EAAG,GAAEA,QAAS;AAJa,GAAf,CAAtB;AAQA,QAAM,CAACJ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,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEZ,QAFT;AAGE,cAAA,QAAQ,EAAEa;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEZ,QAFT;AAGE,cAAA,QAAQ,EAAEa;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF,eA6BE;AAAA,yDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAER,eAFT;AAGE,cAAA,QAAQ,EAAES;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBA7BF,eAoCE;AAAO,YAAA,SAAS,EAAC,uBAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBApCF,eAuCE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAqDD,CAlID;;GAAM7B,M;;KAAAA,M;AAoIN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport config from '../../../config';\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 110,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 69,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"MG/tvUlIVD3u0ENCBSYdvOCrtb8=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","handlefirstnameChange","e","target","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","toggleSignInFormVisible","pageClickEvent","console","log","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handleSignUpFormSubmit"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CL,QAAQ,CAAC,KAAD,CAA5D;AACA,QAAMM,aAAa,GAAGJ,MAAM,CAAC,IAAD,CAA5B;AAEA,QAAM,CAACK,SAAD,EAAYC,YAAZ,IAA4BR,QAAQ,CAAC,EAAD,CAA1C;AACA,QAAM,CAACS,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,EAAD,CAA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SignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n toggleSignInFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n return (\r\n < div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`\r\n }>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport config from \"../../config\";\nimport signUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n console.log(\"Remove eventlistener\");\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n handleSignInFormSubmit(e);\n }\n });\n }\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 155,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 156,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 157,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 154,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 153,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 164,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 168,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 166,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 175,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 173,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 182,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 180,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 165,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 187,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 186,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 185,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 163,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 152,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 194,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"T2hNOC7RRSenezCagXUvA6HqBtE=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","config","signUp","Login","authState","oktaAuth","sessionToken","setSessionToken","toggleSignInFormVisible","showSignUpForm","signUpFormVisibilityState","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","pageClickEvent","e","console","log","signUpFormRef","current","contains","target","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignUpFormSubmit","preventDefault","alert","length","fetch","serviceAPI","createNewUserURL","then","res","ok","Promise","reject","handleSignInFormSubmit","signInWithCredentials","signInWithRedirect","originalUri","catch","err","handlefirstnameChange","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","handlePasswordReset","resetPasswordURL","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AA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,GAAG,IAAH,GAAUK,QAF5C;AAGE,cAAA,QAAQ,EAAE8C;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEnD,yBAAyB,GAAG,IAAH,GAAUO,QAF5C;AAGE,cAAA,QAAQ,EAAE6C;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEE,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAXF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA0CD,GA3CD,MA2CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CA1LD;;GAAM7D,K;UAC4BL,W;;;KAD5BK,K;AA4LN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport config from \"../../config\"\r\nimport signUp from './signUp/SignUp';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n console.log(\"Form visible: \" + signUpFormVisibilityState)\r\n toggleSignInFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n console.log(\"Add eventlistener\")\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n console.log(\"Remove eventlistener\")\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport config from \"../../config\";\nimport SignUp from \"./signUp/SignUp\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"MmTzXSZKancUyLlOOEFKZmNpj1c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","config","SignUp","Login","authState","oktaAuth","sessionToken","setSessionToken","resetPasswordRequestOptions","method","body","userInputData","handleSignInFormSubmit","e","preventDefault","signInWithCredentials","username","password","then","res","signInWithRedirect","originalUri","catch","err","console","log","handlePasswordReset","fetch","serviceAPI","resetPasswordURL","ok","window","alert","Promise","reject","isAuthenticated","toggleSignInFormVisible","signUpFormVisibilityState","handleUsernameChange","handlePasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,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AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEb,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAZF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA2CD,GA5CD,MA4CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CA7FD;;GAAMvB,K;UAC4BL,W;;;KAD5BK,K;AA+FN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport config from \"../../config\"\r\nimport SignUp from \"./signUp/SignUp\"\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignUpFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n console.log(\"Remove eventlistener\");\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// handleSignInFormSubmit(e)\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 110,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 124,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 133,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 131,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 140,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 145,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 150,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 148,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 158,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 159,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignUpFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 160,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 157,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 156,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"qUYGdR3iJtgTZKOx1lTzbuiYPaU=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","FontAwesomeIcon","config","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","toggleSignUpFormVisible","pageClickEvent","e","console","log","current","contains","target","window","addEventListener","removeEventListener","userInputData","JSON","stringify","firstname","lastname","email","username","password","loginRequestOptions","method","body","setfirstname","setlastname","setUsername","setPassword","confirmPassword","setConfirmPassword","handlefirstnameChange","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","handleSignUpFormSubmit","preventDefault","alert","length","fetch","serviceAPI","createNewUserURL","then","res","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AAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YADF,eAoDE;AAAK,MAAA,SAAS,EAAC,QAAf;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,gBAAf;AAAA,gCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAGE;AAAQ,UAAA,SAAS,EAAC,wBAAlB;AAA2C,UAAA,OAAO,EAAEjC,uBAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAHF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YApDF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAiED,CAnKD;;GAAMJ,M;;KAAAA,M;AAqKN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport config from '../../../config';\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n console.log(\"Form visible: \" + signUpFormVisibilityState)\r\n toggleSignUpFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n console.log(\"Add eventlistener\")\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n console.log(\"Remove eventlistener\")\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div>\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignUpFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport config from \"../../config\";\nimport SignUp from \"./signUp/SignUp\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n handleSignInFormSubmit(e);\n }\n });\n }\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 125,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 134,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"MmTzXSZKancUyLlOOEFKZmNpj1c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","config","SignUp","Login","authState","oktaAuth","sessionToken","setSessionToken","resetPasswordRequestOptions","method","body","userInputData","handleSignUpFormSubmit","e","preventDefault","password","confirmPassword","window","alert","length","fetch","serviceAPI","createNewUserURL","loginRequestOptions","then","res","ok","Promise","reject","handleSignInFormSubmit","signInWithCredentials","username","signInWithRedirect","originalUri","catch","err","console","log","handlePasswordReset","resetPasswordURL","isAuthenticated","toggleSignInFormVisible","signUpFormVisibilityState","handleUsernameChange","handlePasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,YAAD,EAAeC,eAAf,IAAkCb,QAAQ,EAAhD;AAEA,QAAMc,2BAA2B,GAAG;AAClCC,IAAAA,MAAM,EAAE,KAD0B;AAElCC,IAAAA,IAAI,EAAEC;AAF4B,GAApC;;AAKA,QAAMC,sBAAsB,GAAIC,CAAD,IAAO;AACpCA,IAAAA,CAAC,CAACC,cAAF;;AAEA,QAAI,CAACC,QAAD,IAAa,CAACC,eAAlB,EAAmC;AACjCC,MAAAA,MAAM,CAACC,KAAP,CAAa,2BAAb;AACA;AACD;;AAED,QAAI,EAAEF,eAAe,CAACG,MAAhB,IAA0B,CAA5B,CAAJ,EAAoC;AAClCF,MAAAA,MAAM,CAACC,KAAP,CAAa,+CAAb;AACA;AACD;;AAED,QAAI,EAAEH,QAAQ,IAAIC,eAAd,CAAJ,EAAoC;AAClCC,MAAAA,MAAM,CAACC,KAAP,CAAa,wBAAb;AACA;AACD,KAHD,MAKK;AACHE,MAAAA,KAAK,CAACnB,MAAM,CAACo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AAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEN,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAZF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA2CD,GA5CD,MA4CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CA9HD;;GAAMnC,K;UAC4BL,W;;;KAD5BK,K;AAgIN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport config from \"../../config\"\r\nimport SignUp from \"./signUp/SignUp\"\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n handleSignInFormSubmit(e);\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 49,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 48,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"X8Ck5qdBspERHliLS55/n2n2lgM=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","handleSignUpFormSubmit","e","preventDefault","window","alert","length","fetch","config","serviceAPI","createNewUserURL","loginRequestOptions","then","res","ok","Promise","reject","handleSignInFormSubmit","handlefirstnameChange","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CL,QAAQ,CAAC,KAAD,CAA5D;AACA,QAAMM,aAAa,GAAGJ,MAAM,CAAC,IAAD,CAA5B;AAEA,QAAM,CAACK,SAAD,EAAYC,YAAZ,IAA4BR,QAAQ,CAAC,EAAD,CAA1C;AACA,QAAM,CAACS,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,EAAD,CAAxC;AACA,QAAM,CAACW,QAAD,EAAWC,WAAX,IAA0BZ,QAAQ,CAAC,EAAD,CAAxC;AACA,QAAM,CAACa,QAAD,EAAWC,WAAX,IAA0Bd,QAAQ,CAAC,EAAD,CAAxC;AACA,QAAM,CAACe,eAAD,EAAkBC,kBAAlB,IAAwChB,QAAQ,CAAC,EAAD,CAAtD;;AAEA,QAAMiB,sBAAsB,GAAIC,CAAD,IAAO;AACpCA,IAAAA,CAAC,CAACC,cAAF;;AAEA,QAAI,CAACN,QAAD,IAAa,CAACE,eAAlB,EAAmC;AACjCK,MAAAA,MAAM,CAACC,KAAP,CAAa,2BAAb;AACA;AACD;;AAED,QAAI,EAAEN,eAAe,CAACO,MAAhB,IAA0B,CAA5B,CAAJ,EAAoC;AAClCF,MAAAA,MAAM,CAACC,KA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,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAExB,QAFT;AAGE,cAAA,QAAQ,EAAEyB;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEvB,QAFT;AAGE,cAAA,QAAQ,EAAEwB;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF,eA6BE;AAAA,yDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEtB,eAFT;AAGE,cAAA,QAAQ,EAAEuB;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBA7BF,eAoCE;AAAO,YAAA,SAAS,EAAC,uBAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBApCF,eAuCE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAqDD,CAhGD;;GAAMnC,M;;KAAAA,M;AAkGN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n toggleSignUpFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// handleSignInFormSubmit(e)\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 129,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 136,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 134,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 141,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 146,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 144,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 154,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 155,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignUpFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 156,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 153,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 152,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"qUYGdR3iJtgTZKOx1lTzbuiYPaU=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","FontAwesomeIcon","config","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","toggleSignUpFormVisible","pageClickEvent","e","console","log","current","contains","target","window","addEventListener","removeEventListener","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handlefirstnameChange","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","handleSignUpFormSubmit","preventDefault","alert","length","fetch","serviceAPI","createNewUserURL","then","res","ok","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CP,QAAQ,CAAC,KAAD,CAA5D;AACA,QAAMQ,aAAa,GAAGN,MAAM,CAAC,IAAD,CAA5B;;AACA,QAAMO,uBAAuB,GAAG,MAAMF,cAAc,CAAC,CAACD,yBAAF,CAApD;;AACAL,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMS,cAAc,GAAIC,CAAD,IAAO;AAC5BC,MAAAA,OAAO,CAACC,GAAR,CAAY,OAAZ;;AACA,UAAIL,aAAa,CAACM,OAAd,KAA0B,IAA1B,IAAkC,CAACN,aAAa,CAACM,OAAd,CAAsBC,QAAtB,CAA+BJ,CAAC,CAACK,MAAjC,CAAvC,EAAiF;AAC/EP,QAAAA,uBAAuB;AACxB;AACF,KALD,CADc,CAQd;;;AACA,QAAIH,yBAAJ,EAA+B;AAC7BW,MAAAA,MAAM,CAACC,gBAAP,CAAwB,OAAxB,EAAiCR,cAAjC;AACD;;AAED,WAAO,MAAM;AACXO,MAAAA,MAAM,CAACE,mBAAP,CAA2B,OAA3B,EAAoCT,cAApC;AACD,KAFD;AAID,GAjBQ,EAiBN,CAACJ,yBAAD,CAjBM,CAAT;AAmBA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BAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YADF,eAoDE;AAAK,MAAA,SAAS,EAAC,QAAf;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,gBAAf;AAAA,gCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAGE;AAAQ,UAAA,SAAS,EAAC,wBAAlB;AAA2C,UAAA,OAAO,EAAEjC,uBAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAHF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YApDF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAiED,CA/JD;;GAAMJ,M;;KAAAA,M;AAiKN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport config from '../../../config';\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n toggleSignUpFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div>\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignUpFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport SignUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 83,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"u8yY6NlW4PSOG6xgLhGhaVL5lVE=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","SignUp","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","handlePasswordReset","fetch","serviceAPI","resetPasswordURL","ok","window","alert","Promise","reject","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BR,WAAW,EAA3C;AACA,QAAM,CAACS,YAAD,EAAeC,eAAf,IAAkCd,QAAQ,EAAhD;AAEA,QAAM,CAACe,QAAD,EAAWC,WAAX,IAA0BhB,QAAQ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eE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEoB,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAHF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AAkCD,GAnCD,MAmCO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CAzGD;;GAAMjC,K;UAC4BN,W;;;KAD5BM,K;AA2GN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport config from \"../../config\";\nimport signUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n console.log(\"Remove eventlistener\");\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 128,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 132,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 130,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 139,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 137,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 146,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 144,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 129,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 151,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 150,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 149,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 158,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"wrhmVp2lhpyin9y/fggBjGZq26c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","config","signUp","Login","authState","oktaAuth","sessionToken","setSessionToken","toggleSignInFormVisible","showSignUpForm","signUpFormVisibilityState","username","setUsername","password","setPassword","pageClickEvent","e","console","log","signUpFormRef","current","contains","target","window","addEventListener","removeEventListener","userInputData","JSON","stringify","firstname","lastname","email","loginRequestOptions","method","body","resetPasswordRequestOptions","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","handlefirstnameChange","setfirstname","value","handlelastnameChange","setlastname","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","setConfirmPassword","handlePasswordReset","fetch","serviceAPI","resetPasswordURL","ok","alert","Promise","reject","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA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;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAXF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA0CD,GA3CD,MA2CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CAtJD;;GAAMnD,K;UAC4BL,W;;;KAD5BK,K;AAwJN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport config from \"../../config\"\r\nimport signUp from './signUp/SignUp';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n console.log(\"Click\")\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n console.log(\"Form visible: \" + signUpFormVisibilityState)\r\n toggleSignInFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n console.log(\"Add eventlistener\")\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n console.log(\"Remove eventlistener\")\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n toggleSignUpFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [signUpFormVisibilityState]);\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handlefirstnameChange = e => {\n setfirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setlastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const handleConfirmPasswordChange = e => {\n setConfirmPassword(e.target.value);\n };\n\n const handleSignUpFormSubmit = e => {\n e.preventDefault();\n\n if (!password || !confirmPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(password == confirmPassword)) {\n window.alert(\"Passwords fo not match\");\n return;\n } else {\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// handleSignInFormSubmit(e)\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 129,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 127,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 136,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 134,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 141,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 146,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 144,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 154,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 155,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignUpFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 156,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 153,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 152,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"qUYGdR3iJtgTZKOx1lTzbuiYPaU=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","FontAwesomeIcon","config","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","toggleSignUpFormVisible","pageClickEvent","e","current","contains","target","window","addEventListener","removeEventListener","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handlefirstnameChange","value","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange","handleSignUpFormSubmit","preventDefault","alert","length","fetch","serviceAPI","createNewUserURL","then","res","ok","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CP,QAAQ,CAAC,KAAD,CAA5D;AACA,QAAMQ,aAAa,GAAGN,MAAM,CAAC,IAAD,CAA5B;;AACA,QAAMO,uBAAuB,GAAG,MAAMF,cAAc,CAAC,CAACD,yBAAF,CAApD;;AAEAL,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMS,cAAc,GAAIC,CAAD,IAAO;AAC5B,UAAIH,aAAa,CAACI,OAAd,KAA0B,IAA1B,IAAkC,CAACJ,aAAa,CAACI,OAAd,CAAsBC,QAAtB,CAA+BF,CAAC,CAACG,MAAjC,CAAvC,EAAiF;AAC/EL,QAAAA,uBAAuB;AACxB;AACF,KAJD,CADc,CAOd;;;AACA,QAAIH,yBAAJ,EAA+B;AAC7BS,MAAAA,MAAM,CAACC,gBAAP,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cAAA,SAAS,EAAC,uBAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBApCF,eAuCE;AAAQ,cAAA,SAAS,EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,yDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YADF,eAoDE;AAAK,MAAA,SAAS,EAAC,QAAf;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,gBAAf;AAAA,gCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAGE;AAAQ,UAAA,SAAS,EAAC,wBAAlB;AAA2C,UAAA,OAAO,EAAE/B,uBAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAHF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YApDF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAiED,CA/JD;;GAAMJ,M;;KAAAA,M;AAiKN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport config from '../../../config';\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n toggleSignUpFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setfirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setlastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords fo not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div>\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignUpFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst signUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 14,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 21,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 33,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 42,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 40,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 8,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 7,\n columnNumber: 5\n }, this);\n};\n\n_s(signUp, \"gjne783thL/vp5Xvi1oK0r4e58s=\");\n\nexport default signUp;","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","signUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","handleSignUpFormSubmit","firstname","handlefirstnameChange","lastname","handlelastnameChange","username","handleUsernameChange","password","handlePasswordChange","confirmPassword","handleConfirmPasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CL,QAAQ,CAAC,KAAD,CAA5D;AAEA,sBACE;AAAK,IAAA,SAAS,EAAG,SAAQI,yBAAyB,GAAG,QAAH,GAAc,UAAW,EAA3E;AAAA,2BACE;AAAK,MAAA,GAAG,EAAEE,aAAV;AAAyB,MAAA,SAAS,EAAC,eAAnC;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,YAAf;AAAA,gCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAM,UAAA,QAAQ,EAAEC,sBAAhB;AAAA,kCACE;AAAA,mDAEE;AACE,cAAA,EAAE,EAAC,WADL;AACiB,cAAA,IAAI,EAAC,MADtB;AAEE,cAAA,KAAK,EAAEC,SAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAA,kDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,MADrB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF,eA6BE;AAAA,yDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEC,eAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBA7BF,eAoCE;AAAO,YAAA,SAAS,EAAC,uBAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBApCF,eAuCE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAqDD,CAxDD;;GAAMd,M;;AA0DN,eAAeA,MAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\n\r\nconst signUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n\r\n return (\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default signUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport config from \"../../config\";\nimport SignUp from \"./signUp/SignUp\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`,\n password: `${password}`\n });\n const resetPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n const handlePasswordReset = () => {\n if (!username == '') {\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n } else {\n window.alert(\"Please enter a valid email into the login form\");\n }\n };\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"spacer\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-container\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Get started with PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 69,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Track bugs and usabilty issues\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"signUpForm-show-button\",\n onClick: toggleSignInFormVisible,\n children: \"Sign up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: signUpFormVisibilityState ? null : username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: signUpFormVisibilityState ? null : password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: handlePasswordReset,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"MmTzXSZKancUyLlOOEFKZmNpj1c=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","config","SignUp","Login","authState","oktaAuth","sessionToken","setSessionToken","userInputData","JSON","stringify","firstname","lastname","email","username","password","resetPasswordRequestOptions","method","body","handleSignInFormSubmit","e","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","handlePasswordReset","fetch","serviceAPI","resetPasswordURL","ok","window","alert","Promise","reject","isAuthenticated","toggleSignInFormVisible","signUpFormVisibilityState","handleUsernameChange","handlePasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,g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AAH,GAAU5B,QAF5C;AAGE,cAAA,QAAQ,EAAE6B;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAED,yBAAyB,GAAG,IAAH,GAAU3B,QAF5C;AAGE,cAAA,QAAQ,EAAE6B;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE;AAAK,UAAA,SAAS,EAAC,wBAAf;AAAA,iCACE;AAAA,mCACE;AAAG,cAAA,OAAO,EAAEb,mBAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAZF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA2CD,GA5CD,MA4CO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CApGD;;GAAM5B,K;UAC4BL,W;;;KAD5BK,K;AAsGN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport config from \"../../config\"\r\nimport SignUp from \"./signUp/SignUp\"\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const resetPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n const handlePasswordReset = () => {\r\n if (!username == '') {\r\n fetch(config.serviceAPI.resetPasswordURL, resetPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n else {\r\n window.alert(\"Please enter a valid email into the login form\")\r\n }\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignInFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={signUpFormVisibilityState ? null : username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={signUpFormVisibilityState ? null : password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={handlePasswordReset}>Forgot password</a>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst SignUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n const signUpFormRef = useRef(null);\n const [firstname, setfirstname] = useState('');\n const [lastname, setlastname] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState);\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 23,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 21,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 30,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 37,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 44,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 42,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 49,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 20,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 18,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 17,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 15,\n columnNumber: 5\n }, this);\n};\n\n_s(SignUp, \"X8Ck5qdBspERHliLS55/n2n2lgM=\");\n\n_c = SignUp;\nexport default SignUp;\n\nvar _c;\n\n$RefreshReg$(_c, \"SignUp\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","useState","useEffect","useRef","SignUp","signUpFormVisibilityState","showSignUpForm","signUpFormRef","firstname","setfirstname","lastname","setlastname","username","setUsername","password","setPassword","confirmPassword","setConfirmPassword","toggleSignInFormVisible","handleSignUpFormSubmit","handlefirstnameChange","handlelastnameChange","handleUsernameChange","handlePasswordChange","handleConfirmPasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAm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ef } from 'react'\r\n\r\nconst SignUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n\r\n const [firstname, setfirstname] = useState('')\r\n const [lastname, setlastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const toggleSignInFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n return (\r\n < div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`\r\n }>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default SignUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\signUp\\\\SignUp.jsx\",\n _s = $RefreshSig$();\n\nimport React from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst signUp = () => {\n _s();\n\n const [signUpFormVisibilityState, showSignUpForm] = useState(false);\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: signUpFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signUpForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign Up\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignUpFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 14,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 21,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 33,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: confirmPassword,\n onChange: handleConfirmPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 42,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 40,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n className: \"password-requirements\",\n children: \"Requirements: At least 8 characters, no parts of your username\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"user-plus\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 8,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 7,\n columnNumber: 5\n }, this);\n};\n\n_s(signUp, \"gjne783thL/vp5Xvi1oK0r4e58s=\");\n\nexport default signUp;","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/signUp/SignUp.jsx"],"names":["React","signUp","signUpFormVisibilityState","showSignUpForm","useState","signUpFormRef","handleSignUpFormSubmit","firstname","handlefirstnameChange","lastname","handlelastnameChange","username","handleUsernameChange","password","handlePasswordChange","confirmPassword","handleConfirmPasswordChange"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM,CAACC,yBAAD,EAA4BC,cAA5B,IAA8CC,QAAQ,CAAC,KAAD,CAA5D;AAEA,sBACE;AAAK,IAAA,SAAS,EAAG,SAAQF,yBAAyB,GAAG,QAAH,GAAc,UAAW,EAA3E;AAAA,2BACE;AAAK,MAAA,GAAG,EAAEG,aAAV;AAAyB,MAAA,SAAS,EAAC,eAAnC;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,YAAf;AAAA,gCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAM,UAAA,QAAQ,EAAEC,sBAAhB;AAAA,kCACE;AAAA,mDAEE;AACE,cAAA,EAAE,EAAC,WADL;AACiB,cAAA,IAAI,EAAC,MADtB;AAEE,cAAA,KAAK,EAAEC,SAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAA,kDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,MADrB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAA,iDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEC,QAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF,eA6BE;AAAA,yDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,UADrB;AAEE,cAAA,KAAK,EAAEC,eAFT;AAGE,cAAA,QAAQ,EAAEC;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBA7BF,eAoCE;AAAO,YAAA,SAAS,EAAC,uBAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBApCF,eAuCE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAvCF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAqDD,CAxDD;;GAAMf,M;;AA0DN,eAAeA,MAAf","sourcesContent":["import React from 'react'\r\n\r\nconst signUp = () => {\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n\r\n return (\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default signUp\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n console.log(\"Click\");\n\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\n console.log(\"Form visible: \" + signUpFormVisibilityState);\n toggleSignInFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (signUpFormVisibilityState) {\n console.log(\"Add eventlistener\");\n