Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon AWS S3 bucket takeover #761

Open
bright-security-dev bot opened this issue Dec 17, 2023 · 0 comments
Open

Amazon AWS S3 bucket takeover #761

bright-security-dev bot opened this issue Dec 17, 2023 · 0 comments

Comments

@bright-security-dev
Copy link

Amazon AWS S3 bucket takeover

Severity: High Discovered: 17 of December-2023, 06:00 PM UTC

CWE ID

CWE-284

CVSS

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Details

Target application contains a reference to an S3 bucket that no longer exists.
An attacker can register a new S3 bucket under the same original name.
The target application would use the new S3 bucket under the control of the attacker.
Attacker can populate the S3 bucket with malicious content or intercept legitimate traffic intended for the S3 bucket,
potentially leading to data theft or other malicious activities.

Possible exposure

Data breaches, Malware distribution, negatively impact reputation

Remediation suggestions

Remove unused S3 buckets reference URLs from code.

Request

GET http://brokencrystals.com/static/js/main.d0e39dc9.chunk.js HTTP/1.1
Accept: aaa 
Referer: http://brokencrystals.com/
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/106.0.5249.119 Safari/537.36
accept-charset: 
Cookie: bc-calls-counter=1702835435835; connect.sid=fLHp6nIkaJ_YEbd0c4TY9to9GCGx2O4E.nVorEU%2FR5s3b2KzyCra4AXu2sSr282WQVvAnlwQgTR0
Accept-Encoding: identity
Content-Length: 0

Response

HTTP/1.1 200
Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 51167
Content-Type: application/javascript
Date: Sun, 17 Dec 2023 18:00:52 GMT
ETag: "65253d32-c7df"
Last-Modified: Tue, 10 Oct 2023 12:01:54 GMT

(this["webpackJsonpreact-broken-crystals"]=this["webpackJsonpreact-broken-crystals"]||[]).push([[0],{121:function(e,t,a){"use strict";a.r(t);var c=a(1),n=a(51),s=a.n(n);var i=a(7),r=a(5),o=a(2),l=a(3),u=a(9),d=a(0),j=[{name:"Home",path:"/?maptitle=map",newTab:!1},{name:"Marketplace",path:"/marketplace?videosrc=https://www.youtube-nocookie.com/embed/MPYlxeG-8_w?controls=0",newTab:!1},{name:"Edit user data",path:r.a.Userprofile,newTab:!1},{name:"Adminmenu",path:"",newTab:!1,admin:!0,subItems:[{name:"Adminpage",path:r.a.Adminpage,newTab:!1},{name:"Dashboard",path:r.a.Dashboard,newTab:!1}]},{name:"API Schema",path:"",newTab:!1,subItems:[{name:"OpenAPI 3.0 JSON",path:"/swagger-json",newTab:!0},{name:"API Reference",path:"/swagger",newTab:!0},{name:"GraphiQL",path:"/graphiql",newTab:!0}]},{name:"Vulnerabilities",path:"https://github.com/NeuraLegion/brokencrystals#vulnerabilities-overview",newTab:!0}],m=function(){var e=sessionStorage.getItem("email")||localStorage.getItem("email"),t=Object(c.useState)(!1),a=Object(o.a)(t,2),n=a[0],s=a[1];Object(c.useEffect)((function(){i()}),[n]);var i=function(){e&&Object(l.a)(e).then((function(e){s(e.isAdmin)}))};return Object(d.jsx)("nav",{className:"nav-menu d-none d-lg-block",children:Object(d.jsx)("ul",{children:j.map((function(e,t){return!e.admin||n?function(e,t){return Object(d.jsxs)("li",{className:"".concat(e.subItems&&"drop-down"," ").concat(window.location.pathname==e.path&&"active"),children:[Object(d.jsx)("a",{href:e.path,target:e.newTab?"_blank":void 0,children:e.name}),e.subItems&&Object(d.jsx)("ul",{children:e.subItems.map((function(e,t){return Object(d.jsx)("li",{children:Object(d.jsx)("a",{href:e.path,target:e.newTab?"_blank":void 0,children:e.name})},t)}))})]},t)}(e,t):Object(d.jsx)(d.Fragment,{})}))})})},b=a(53),h=function(e){Object(c.useEffect)((function(){Object(l.q)().then((function(e){return console.log("xml",e)})),Object(l.g)().then((function(e){return console.log("spawn",e)}))}),[]);var t;return Object(d.jsx)("header",{id:"header",className:"fixed-top ".concat(e.onInnerPage?"header-inner-pages":""),children:Object(d.jsx)("div",{className:"container-fluid",children:Object(d.jsx)("div",{className:"row justify-content-center",children:Object(d.jsxs)("div",{className:"col-xl-9 d-flex align-items-center",children:[Object(d.jsxs)(u.a,{to:"/",className:"logo mr-auto",onClick:(t="/",function(){Object(l.m)(t).then((function(){return console.log("goto",t)}))}),children:[Object(d.jsx)("img",{src:"assets/img/logo.png",alt:"",className:"img-fluid"})," ","BROKEN CRYSTALS"]}),Object(d.jsx)(m,{}),Object(d.jsx)(b.a,{})]})})})})},p=a(57),O=a.n(p),x=(a(119),a(120),a(11)),f=a(4),g={name:"",title:"",message:""},v=function(e){var t=sessionStorage.getItem("email")||localStorage.getItem("email"),a=Object(c.useState)(g),n=Object(o.a)(a,2),s=n[0],i=n[1],r=s.name,u=s.title,j=s.message,m=e.setNewTestimonial,b=function(e){var t=e.target,a=t.name,c=t.value;i(Object(f.a)(Object(f.a)({},s),{},Object(x.a)({},a,c)))};return Object(d.jsx)(d.Fragment,{children:t&&Object(d.jsx)("div",{className:"container mt-5","data-aos":"fade-up",children:Object(d.jsxs)("form",{role:"form",onSubmit:function(e){e.preventDefault(),Object(l.t)(s).then((function(){m&&m(s),i(g)}))},children:[Object(d.jsxs)("div",{className:"form-row",children:[Object(d.jsxs)("div",{className:"col-md-6 form-group",children:[Object(d.jsx)("input",{type:"text",name:"name",className:"form-control",id:"name",placeholder:"Your Name","data-rule":"minlen:4","data-msg":"Please enter at least 4 chars",value:r,onInput:b}),Object(d.jsx)("div",{className:"validate"})]}),Object(d.jsxs)("div",{className:"col-md-6 form-group",children:[Object(d.jsx)("input",{type:"text",className:"form-control",name:"title",id:"job-title",placeholder:"Your Title","data-rule":"minlen:4","data-msg":"Please enter at least 4 chars",value:u,onInput:b}),Object(d.jsx)("div",{className:"validate"})]})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("textarea",{className:"form-control",name:"message",rows:5,"data-rule":"required","data-msg":"Please write something for us",placeholder:"Testimonial",value:j,onChange:b}),Object(d.jsx)("div",{className:"validate"})]}),Object(d.jsx)("div",{className:"text-center",children:Object(d.jsx)("button",{className:"submit-testimonial",type:"submit",children:"Send Testimonial"})})]})})})},N=a(15),w=function(e){var t=e.testimonials;return Object(d.jsx)(d.Fragment,{children:t.map((function(e,t){return Object(d.jsxs)("div",{className:"testimonial-item",children:[Object(d.jsxs)("p",{children:[Object(d.jsx)("i",{className:"bx bxs-quote-alt-left quote-icon-left"}),Object(d.jsx)("span",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:e.message})}),Object(d.jsx)("i",{className:"bx bxs-quote-alt-right quote-icon-right"})]}),Object(d.jsx)("img",{src:"assets/img/testimonials/testimonials-1.jpg",className:"testimonial-img",alt:""}),Object(d.jsx)("h3",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:e.name})}),Object(d.jsx)("h4",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:e.title})})]},e.name+t)}))})},S=function(e){var t=Object(c.useState)([]),a=Object(o.a)(t,2),n=a[0],s=a[1],i=Object(c.useState)(),r=Object(o.a)(i,2),u=r[0],j=r[1],m=Object(c.useState)(0),b=Object(o.a)(m,2),h=b[0],p=b[1];return Object(c.useEffect)((function(){Object(l.h)().then((function(e){return s(e)})),Object(l.i)().then((function(e){return p(e)}))}),[]),Object(c.useEffect)((function(){if(u)return Object(l.h)().then((function(e){return s(e)})),Object(l.i)().then((function(e){return p(e)})),function(){return s([])}}),[u]),Object(d.jsxs)("section",{id:"testimonials",className:"testimonials section-bg",children:[Object(d.jsxs)("div",{className:"container","data-aos":"fade-up",children:[Object(d.jsxs)("div",{className:"section-title",children:[Object(d.jsxs)("h2",{children:["Testimonials (",h,")"]}),Object(d.jsx)("p",{children:"Magnam dolores commodi suscipit. Necessitatibus eius consequatur ex aliquid fuga eum quidem. Sit sint consectetur velit. Quisquam quos quisquam cupiditate. Et nemo qui impedit suscipit alias ea. Quia fugiat sit in iste officiis commodi quidem hic quas."})]}),(null===n||void 0===n?void 0:n.length)?Object(d.jsx)(O.a,{className:"owl-carousel",dots:!0,items:3,loop:!1,children:Object(d.jsx)(w,{testimonials:n})}):null]}),e.preview||Object(d.jsx)(v,{setNewTestimonial:j})]})},y=function(e){return Object(d.jsx)("div",{className:"col-lg-4 col-md-6 portfolio-item filter-".concat(e.product.category),children:Object(d.jsxs)("div",{className:"portfolio-wrap",children:[Object(d.jsx)("img",{src:e.product.photoUrl,className:"img-fluid",alt:"",onLoad:function(){return Object(l.A)(e.product.name)}}),Object(d.jsxs)("div",{className:"portfolio-info",children:[Object(d.jsx)("h4",{children:e.product.name}),Object(d.jsx)("p",{children:e.product.description})]}),Object(d.jsx)("div",{className:"portfolio-links",children:Object(d.jsx)("a",{href:e.product.photoUrl,"data-gall":"portfolioGallery",className:"venobox",title:e.product.name,children:Object(d.jsx)("i",{className:"bx bx-plus"})})})]})},e.product.name)},k="/home/node/",I=function(e){var t=Object(c.useState)([]),a=Object(o.a)(t,2),n=a[0],s=a[1],i=Object(c.useState)(""),r=Object(o.a)(i,2),u=r[0],j=r[1],m=Object(c.useState)(""),b=Object(o.a)(m,2),p=b[0],O=b[1];return Object(c.useEffect)((function(){e.preview?Object(l.c)().then((function(e){return s(e)})):Object(l.f)().then((function(e){return s(e)}))}),[]),Object(c.useEffect)((function(){var e=document.getElementById("testimonials-video"),t=new URL(window.location.href).searchParams.get("videosrc");t=t||"https://www.youtube-nocookie.com/embed/MPYlxeG-8_w?controls=0",e&&(e.outerHTML='<iframe width="560" height="315" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" '.concat(t&&'src="'+t,'"></iframe>'))}),[]),Object(d.jsxs)("section",{children:[e.preview||Object(d.jsx)(h,{onInnerPage:!0}),Object(d.jsxs)("section",{id:"marketplace",className:"portfolio",children:[Object(d.jsxs)("div",{className:"container","data-aos":"fade-up",children:[Object(d.jsx)("div",{className:"section-title marketplaceTitle",children:Object(d.jsx)("h2",{children:"Marketplace"})}),e.preview||Object(d.jsx)("div",{className:"row",children:Object(d.jsx)("div",{className:"col-lg-12 d-flex justify-content-center",children:Object(d.jsxs)("ul",{id:"portfolio-flters",children:[Object(d.jsx)("li",{"data-filter":"*",className:"filter-active",children:"All"}),Object(d.jsx)("li",{"data-filter":".filter-Healing",children:"Healing"}),Object(d.jsx)("li",{"data-filter":".filter-Jewellery",children:"Jewellery"}),Object(d.jsx)("li",{"data-filter":".filter-Gemstones",children:"Gemstones"})]})})}),Object(d.jsx)("div",{className:"row portfolio-container",children:n&&n.map((function(e,t){return Object(d.jsx)(y,{product:e},t)}))})]}),e.preview&&Object(d.jsx)("div",{className:"section-readmore",children:Object(d.jsx)("a",{href:"/marketplace",children:Object(d.jsx)("span",{children:"See all products"})})})]}),Object(d.jsx)(S,{preview:e.preview}),Object(d.jsx)("section",{id:"feedback",className:"testimonials section-bg",children:Object(d.jsx)("div",{className:"container","data-aos":"fade-up",children:Object(d.jsxs)("div",{className:"section-title",children:[Object(d.jsx)("h2",{children:"feedback"}),Object(d.jsx)("span",{children:"Please, upload a feedback: "}),Object(d.jsx)("label",{htmlFor:"feedback-file-input",className:"file-input-label",children:Object(d.jsx)("img",{src:"assets/img/upload-file.svg",alt:"",className:"upload-file-image"})}),Object(d.jsx)("input",{id:"feedback-file-input",type:"file",accept:"file/*",style:{display:"none"},onChange:function(e){var t=e.target.files[0];Object(l.v)("".concat(k).concat(t.name),t).then((function(e){j(e),O(t.name)}))}}),u.length>0&&Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("div",{className:"warning-text",children:u}),Object(d.jsxs)("div",{children:["You can reach your file"," ",Object(d.jsx)("a",{href:"#",onClick:function(e){e.preventDefault(),Object(l.b)("".concat(k).concat(p)).then((function(e){var t=window.URL.createObjectURL(new Blob([e])),a=document.createElement("a");a.href=t,a.setAttribute("download",p),document.body.appendChild(a),a.click(),document.body.removeChild(a)}))},children:"here"})]})]})]})})}),e.preview||Object(d.jsx)("section",{id:"video",className:"testimonials section-bg",children:Object(d.jsx)("div",{className:"container d-flex justify-content-center","data-aos":"fade-up",children:Object(d.jsx)("iframe",{width:"560",height:"315",id:"testimonials-video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"})})})]})},C=function(){return Object(d.jsx)("section",{id:"counts",className:"counts",children:Object(d.jsx)("div",{className:"container",children:Object(d.jsx)("div",{className:"row counters",children:[{name:"Crystals",value:154},{name:"Gemstones",value:78},{name:"Jewellery",value:23},{name:"Massage",value:9}].map((function(e,t){return Object(d.jsxs)("div",{className:"col-lg-3 col-6 text-center",children:[Object(d.jsx)("span",{"data-toggle":"counter-up",children:e.value}),Object(d.jsx)("p",{children:e.name})]},"counter-".concat(t))}))})})})},q=function(){return Object(d.jsx)("section",{id:"hero",className:"d-flex align-items-center",children:Object(d.jsx)("div",{className:"container-fluid","data-aos":"fade-up",children:Object(d.jsxs)("div",{className:"row justify-content-center",children:[Object(d.jsxs)("div",{className:"col-xl-5 col-lg-6 pt-3 pt-lg-0 order-2 order-lg-1 d-flex flex-column justify-content-center",children:[Object(d.jsx)("h1",{children:"Your Vulnerable Crystal Marketplace"}),Object(d.jsx)("h2",{children:"Find the most beautiful stones in one place!"}),Object(d.jsx)("div",{children:Object(d.jsx)("a",{href:"#marketplacePreview",className:"btn-get-started scrollto",children:"Get Started"})})]}),Object(d.jsx)("div",{className:"col-xl-4 col-lg-6 order-1 order-lg-2 hero-img","data-aos":"zoom-in","data-aos-delay":"150",children:Object(d.jsx)("img",{src:"assets/img/hero-img.png",className:"img-fluid animated",alt:""})})]})})})},T=function(){return Object(d.jsx)("section",{id:"faq",className:"faq",children:Object(d.jsxs)("div",{className:"container","data-aos":"fade-up",children:[Object(d.jsxs)("div",{className:"section-title",children:[Object(d.jsx)("h2",{children:"Frequently Asked Questions"}),Object(d.jsx)("p",{children:"Magnam dolores commodi suscipit. Necessitatibus eius consequatur ex aliquid fuga eum quidem. Sit sint consectetur velit. Quisquam quos quisquam cupiditate. Et nemo qui impedit suscipit alias ea. Quia fugiat sit in iste officiis commodi quidem hic quas."})]}),Object(d.jsx)("div",{className:"faq-list",children:Object(d.jsx)("ul",{children:[{question:"Non consectetur a erat nam at lectus urna duis?",answer:"Feugiat pretium nibh ipsum consequat. Tempus iaculis urna id volutpat lacus laoreet non curabitur gravida. Venenatis lectus magna fringilla urna porttitor rhoncus dolor purus non."},{question:"Feugiat scelerisque varius morbi enim nunc?",answer:"Dolor sit amet consectetur adipiscing elit pellentesque habitant morbi. Id interdum velit laoreet id donec ultrices. Fringilla phasellus faucibus scelerisque eleifend donec pretium. Est pellentesque elit ullamcorper dignissim. Mauris ultrices eros in cursus turpis massa tincidunt dui."},{question:"Dolor sit amet consectetur adipiscing elit?",answer:"Eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci. Faucibus pulvinar elementum integer enim. Sem nulla pharetra diam sit amet nisl suscipit. Rutrum tellus pellentesque eu tincidunt. Lectus urna duis convallis convallis tellus. Urna molestie at elementum eu facilisis sed odio morbi quis."},{question:"Tempus quam pellentesque nec nam aliquam sem et tortor consequat?",answer:"Molestie a iaculis at erat pellentesque adipiscing commodo. Dignissim suspendisse in est ante in. Nunc vel risus commodo viverra maecenas accumsan. Sit amet nisl suscipit adipiscing bibendum est. Purus gravida quis blandit turpis cursus in."},{question:"Tortor vitae purus faucibus ornare. Varius vel pharetra vel turpis nunc eget lorem dolor?",answer:"Laoreet sit amet cursus sit amet dictum sit amet justo. Mauris vitae ultricies leo integer malesuada nunc vel. Tincidunt eget nullam non nisi est sit amet. Turpis nunc eget lorem dolor sed. Ut venenatis tellus in metus vulputate eu scelerisque."}].map((function(e,t){return Object(d.jsxs)("li",{"data-aos":"fade-up","data-aos-delay":100*t,children:[Object(d.jsx)("i",{className:"bx bx-help-circle icon-help"})," ",Object(d.jsxs)("a",{"data-toggle":"collapse",className:0===t?"collapse":"collapsed",href:"#faq-list-".concat(t),children:[e.question,Object(d.jsx)("i",{className:"bx bx-chevron-down icon-show"}),Object(d.jsx)("i",{className:"bx bx-chevron-up icon-close"})]}),Object(d.jsx)("div",{id:"faq-list-".concat(t),className:"collapse ".concat(0===t&&"show"),"data-parent":".faq-list",children:Object(d.jsx)("p",{children:e.answer})})]},"faq-item-".concat(t))}))})})]})})},A=function(e){return Object(c.useEffect)((function(){var t=document.getElementById("about-map");t&&(t.outerHTML='<iframe class="mb-4 mb-lg-0" title="'.concat(e.mapTitle||"",'" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12097.433213460943!2d-74.0062269!3d40.7101282!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0xb89d1fe6bc499443!2sDowntown+Conference+Center!5e0!3m2!1smk!2sbg!4v1539943755621" frameborder="0" allowfullscreen="" style="border: 0px; width: 100%; height: 384px;"></iframe>'))}),[]),Object(d.jsx)("section",{id:"contact",className:"contact section-bg",children:Object(d.jsxs)("div",{className:"container","data-aos":"fade-up",children:[Object(d.jsxs)("div",{className:"section-title",children:[Object(d.jsx)("h2",{children:"Contact"}),Object(d.jsx)("p",{children:"Magnam dolores commodi suscipit. Necessitatibus eius consequatur ex aliquid fuga eum quidem. Sit sint consectetur velit. Quisquam quos quisquam cupiditate. Et nemo qui impedit suscipit alias ea. Quia fugiat sit in iste officiis commodi quidem hic quas."})]}),Object(d.jsxs)("div",{className:"row",children:[Object(d.jsx)("div",{className:"col-lg-6",children:Object(d.jsxs)("div",{className:"info-box mb-4",children:[Object(d.jsx)("i",{className:"bx bx-map"}),Object(d.jsx)("h3",{children:"Our Address"}),Object(d.jsx)("p",{children:"A108 Adam Street, New York, NY 535022"})]})}),Object(d.jsx)("div",{className:"col-lg-3 col-md-6",children:Object(d.jsxs)("div",{className:"info-box  mb-4",children:[Object(d.jsx)("i",{className:"bx bx-envelope"}),Object(d.jsx)("h3",{children:"Email Us"}),Object(d.jsx)("p",{children:"contact@example.com"})]})}),Object(d.jsx)("div",{className:"col-lg-3 col-md-6",children:Object(d.jsxs)("div",{className:"info-box  mb-4",children:[Object(d.jsx)("i",{className:"bx bx-phone-call"}),Object(d.jsx)("h3",{children:"Call Us"}),Object(d.jsx)("p",{children:"+1 5589 55488 55"})]})})]}),Object(d.jsxs)("div",{className:"row",children:[Object(d.jsx)("div",{className:"col-lg-6 ",children:Object(d.jsx)("iframe",{className:"mb-4 mb-lg-0",id:"about-map",src:"https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12097.433213460943!2d-74.0062269!3d40.7101282!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0xb89d1fe6bc499443!2sDowntown+Conference+Center!5e0!3m2!1smk!2sbg!4v1539943755621",frameBorder:"0",style:{border:0,width:"100%",height:384},allowFullScreen:!0})}),Object(d.jsx)("div",{className:"col-lg-6",children:Object(d.jsxs)("form",{role:"form",className:"php-email-form",children:[Object(d.jsxs)("div",{className:"form-row",children:[Object(d.jsxs)("div",{className:"col-md-6 form-group",children:[Object(d.jsx)("input",{type:"text",name:"name",className:"form-control",id:"name",placeholder:"Your Name","data-rule":"minlen:4","data-msg":"Please enter at least 4 chars"}),Object(d.jsx)("div",{className:"validate"})]}),Object(d.jsxs)("div",{className:"col-md-6 form-group",children:[Object(d.jsx)("input",{type:"email",className:"form-control",name:"email",id:"email",placeholder:"Your Email","data-rule":"email","data-msg":"Please enter a valid email"}),Object(d.jsx)("div",{className:"validate"})]})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("input",{type:"text",className:"form-control",name:"subject",id:"subject",placeholder:"Subject","data-rule":"minlen:4","data-msg":"Please enter at least 8 chars of subject"}),Object(d.jsx)("div",{className:"validate"})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("textarea",{className:"form-control",name:"message",rows:5,"data-rule":"required","data-msg":"Please write something for us",placeholder:"Message"}),Object(d.jsx)("div",{className:"validate"})]}),Object(d.jsxs)("div",{className:"mb-3",children:[Object(d.jsx)("div",{className:"loading",children:"Loading"}),Object(d.jsx)("div",{className:"error-message"}),Object(d.jsx)("div",{className:"sent-message",children:"Your message has been sent. Thank you!"})]}),Object(d.jsx)("div",{className:"text-center",children:Object(d.jsx)("button",{type:"submit",children:"Send Message"})})]})})]})]})})},E=function(){var e=Object(c.useState)(""),t=Object(o.a)(e,2),a=t[0],n=t[1],s=Object(c.useState)(),i=Object(o.a)(s,2),r=i[0],j=i[1],m=Object(c.useState)(""),b=Object(o.a)(m,2),h=b[0],p=b[1];Object(c.useEffect)((function(){Object(l.r)('{{="+1"}} {{=5589}} {{=55488}} {{=55}}').then((function(e){return p(e)}))}),[]);var O=[{title:"Useful Links",items:[{name:"Home",url:"/",icon:"bx-chevron-right"},{name:"About us",url:"/",icon:"bx-chevron-right"},{name:"Services",url:"/",icon:"bx-chevron-right"},{name:"Terms of service",url:"/api/goto?url=http://google.com",icon:"bx-chevron-right"},{name:"Privacy policy",url:"https://takemeover-bright.s3.amazonaws.com/privacy-policy.pdf",icon:"bx-chevron-right"}]},{title:"Our Services",items:[{name:"Web Design",url:"/",icon:"bx-chevron-right"},{name:"Web Development",url:"/",icon:"bx-chevron-right"},{name:"Product Management",url:"/",icon:"bx-chevron-right"},{name:"Marketing",url:"/",icon:"bx-chevron-right"},{name:"Graphic Design",url:"/",icon:"bx-chevron-right"}]}],x=[{title:"Find us on",items:[{name:"twitter",url:"/",icon:"bxl-twitter"},{name:"facebook",url:"/",icon:"bxl-facebook"},{name:"instagram",url:"/",icon:"bxl-instagram"},{name:"google-plus",url:"/",icon:"bxl-google-plus"},{name:"linkedIn",url:"/",icon:"bxl-linkedin"}]},{title:"Supporting",items:[{name:"google",url:"/api/file/google?path=google",icon:"bxl-google"},{name:"aws",url:"/api/file/aws?path=aws",icon:"bxl-amazon"},{name:"azure",url:"/api/file/azure?path=azure",icon:"bxl-microsoft"},{name:"digital_ocean",url:"/api/file/digital_ocean?path=digital_ocean",icon:"bxl-digitalocean"}]}];return Object(d.jsxs)("footer",{id:"footer",children:[Object(d.jsx)("div",{className:"footer-top",children:Object(d.jsx)("div",{className:"container",children:Object(d.jsxs)("div",{className:"row",children:[Object(d.jsxs)("div",{className:"col-lg-3 col-md-6 footer-contact",children:[Object(d.jsx)(u.a,{to:"/",className:"logo mr-auto",children:Object(d.jsx)("img",{width:100,height:100,src:"assets/img/logo.png",alt:"",className:"img-fluid"})}),Object(d.jsx)("h3",{children:"BROKEN CRYSTALS"}),Object(d.jsxs)("div",{children:["A108 Adam Street ",Object(d.jsx)("br",{}),"New York, NY 535022",Object(d.jsx)("br",{}),"United States ",Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),Object(d.jsx)("strong",{children:"Phone:"})," ",h&&Object(d.jsx)("span",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:h})}),Object(d.jsx)("br",{}),Object(d.jsx)("strong",{children:"Email:"})," info@example.com",Object(d.jsx)("br",{}),Object(d.jsx)("a",{href:"/api/secrets",children:"\ud83e\udd2b"})]})]}),O.map((function(e,t){return Object(d.jsxs)("div",{className:"col-lg-2 col-md-6 footer-links",children:[Object(d.jsx)("h4",{children:e.title}),Object(d.jsx)("ul",{children:e.items.map((function(t,a){return Object(d.jsxs)("li",{children:[Object(d.jsx)("i",{className:"bx ".concat(t.icon)})," ",Object(d.jsx)("a",{href:t.url,children:t.name})]},"".concat(e.title,"-item-").concat(a))}))})]},"footer-links-section-".concat(t))})),Object(d.jsxs)("div",{className:"col-lg-4 col-md-6 footer-newsletter",children:[Object(d.jsx)("h4",{children:"Join Our Newsletter"}),Object(d.jsx)("p",{children:"Tamen quem nulla quae legam multos aute sint culpa legam noster magna"}),Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault(),Object(l.s)(a).then((function(e){return j(e)}))},children:[Object(d.jsx)("input",{type:"input",name:"input",value:a,onInput:function(e){var t=e.target.value;n(t)}}),Object(d.jsx)("input",{type:"submit",value:"Subscribe"})]}),r&&Object(d.jsx)("div",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:r+" subscribed."})})]})]})})}),Object(d.jsx)("div",{className:"container",children:Object(d.jsxs)("div",{className:"copyright-wrap d-md-flex py-4",children:[Object(d.jsxs)("div",{className:"mr-md-auto text-center text-md-left",children:[Object(d.jsxs)("div",{className:"copyright",children:["\xa9 Copyright"," ",Object(d.jsx)("strong",{children:Object(d.jsx)("span",{children:"Broken Crystals"})}),". All Rights Reserved"]}),Object(d.jsx)("span",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:decodeURIComponent(window.location.search)})})]}),Object(d.jsx)("table",{children:Object(d.jsx)("tbody",{children:x.map((function(e,t){return Object(d.jsxs)("tr",{children:[Object(d.jsx)("td",{children:"".concat(e.title,": ")}),Object(d.jsx)("td",{children:Object(d.jsx)("div",{className:"px-1 d-flex flex-row align-items-start social-links text-center text-md-right pt-3 pt-md-0",children:e.items.map((function(t,a){return Object(d.jsx)("a",{href:t.url,children:Object(d.jsx)("i",{className:"bx ".concat(t.icon)})},"".concat(e.title,"-item-").concat(a))}))})})]},"social-section-".concat(t))}))})})]})})]})},F=function(){var e=new URL(window.location.href).searchParams.get("maptitle");return Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(h,{}),Object(d.jsx)(q,{}),Object(d.jsxs)("main",{id:"main",children:[Object(d.jsx)("div",{id:"marketplacePreview",children:Object(d.jsx)(I,{preview:!0})}),Object(d.jsx)(C,{}),Object(d.jsx)(T,{}),Object(d.jsx)(A,{mapTitle:e})]}),Object(d.jsx)(E,{}),Object(d.jsx)("a",{href:"/",className:"back-to-top",children:Object(d.jsx)("i",{className:"icofont-simple-up"})}),Object(d.jsx)("div",{id:"preloader"})]})},L=a(35),R=a(6),P=function(e){var t=e.children,a=e.logoBgColor,n=Object(c.useRef)(null);return Object(c.useEffect)((function(){n.current&&(n.current.style.cssText="background-color: ".concat(a))})),Object(d.jsx)("div",{className:"page-content--bge5",children:Object(d.jsx)("div",{className:"container",children:Object(d.jsx)("div",{className:"login-wrap",children:Object(d.jsxs)("div",{className:"login-content",children:[Object(d.jsx)("div",{className:"login-logo",children:Object(d.jsxs)("a",{href:"/",className:"logo mr-auto",children:[Object(d.jsx)("img",{width:100,height:100,src:"assets/img/logo_blue.png",alt:"logo",className:"img-fluid",ref:n}),"BROKEN CRYSTALS"]})}),t]})})})})};var D=function(e){var t=[{title:"Email",value:e.email},{title:"First Name",value:e.firstName},{title:"Last Name",value:e.lastName}];return Object(d.jsx)(d.Fragment,{children:t.map((function(e){var t=e.title,a=e.value;return a&&Object(d.jsx)("div",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:"".concat(t,": ").concat(a)})},t)}))})};var U=function(e){return(null===e||void 0===e?void 0:e.length)?Object(d.jsx)(d.Fragment,{children:e.map((function(e){return Object(d.jsx)("div",{children:D(e)},e.email)}))}):null};var M,B=function(e){var t=[{title:"Email",value:e.email},{title:"LDAP",value:e.ldapProfileLink}];return Object(d.jsx)(d.Fragment,{children:t.map((function(e){var t=e.title,a=e.value;return a&&Object(d.jsx)("div",{className:"dangerous-html",children:Object(d.jsx)(N.a,{html:"".concat(t,": ").concat(a)})},t)}))})},_={user:"",password:"",op:R.a.BASIC};!function(e){e.FORM_URLENCODED="application/x-www-form-urlencoded",e.APPLICATION_JSON="application/json"}(M||(M={}));var H,Y=function(){var e=Object(i.g)().state,t=Object(c.useState)(_),a=Object(o.a)(t,2),n=a[0],s=a[1],j=n.user,m=n.password,b=Object(c.useState)(),h=Object(o.a)(b,2),p=h[0],O=h[1],g=Object(c.useState)([]),v=Object(o.a)(g,2),N=v[0],w=v[1],S=Object(c.useState)(),y=Object(o.a)(S,2),k=y[0],I=y[1],C=Object(c.useState)(R.a.BASIC),q=Object(o.a)(C,2),T=q[0],A=q[1],E=Object(c.useState)(),F=Object(o.a)(E,2),D=F[0],H=F[1],Y=Object(c.useState)(),z=Object(o.a)(Y,2),G=z[0],J=z[1],Q=function(e){var t=e.target,a=t.name,c=t.value;s(Object(f.a)(Object(f.a)({},n),{},Object(x.a)({},a,c)))},V=function(e){switch(T){case R.a.CSRF:return Object(f.a)(Object(f.a)({},e),{},{csrf:D});case R.a.DOM_BASED_CSRF:var t=Object(L.a)();return Object(f.a)(Object(f.a)({},e),{},{csrf:D,fingerprint:t});default:return e}};return Object(c.useEffect)((function(){return function(){var t=(p||{}).ldapProfileLink;t&&Object(l.d)(t).then((function(e){return w(e)})).then((function(){window.location.href=e?e.from:"/"}))}()}),[p]),Object(c.useEffect)((function(){switch(T){case R.a.CSRF:return void Object(l.p)().then((function(e){return H(e)}));case R.a.DOM_BASED_CSRF:return e=Object(L.a)(),void Object(l.o)(e).then((function(e){return H(e)}));case R.a.OIDC:return void Object(l.e)().then((function(e){return J(e)}))}var e}),[T]),Object(d.jsx)(P,{logoBgColor:new URL(window.location.href).searchParams.get("logobgcolor")||"transparent",children:Object(d.jsxs)("div",{className:"login-form",children:[Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault();var t=T===R.a.HTML?{headers:{"content-type":M.FORM_URLENCODED}}:{},a=V(n);Object(l.j)(a,t).then((function(e){return O(e),e})).then((function(e){var t=e.email,a=e.errorText;return a&&I(a),sessionStorage.setItem("email",t),Object(l.k)(t)})).then((function(e){return sessionStorage.setItem("userName","".concat(e.firstName," ").concat(e.lastName))}))},children:[Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Authentication Type"}),Object(d.jsxs)("select",{className:"form-control",name:"op",placeholder:"Authentication Type",value:T,onChange:function(e){var t=e.target.value;s(Object(f.a)(Object(f.a)({},n),{},{op:t})),A(t)},children:[Object(d.jsx)("option",{value:R.a.BASIC,children:"Simple REST-based Authentication"}),Object(d.jsx)("option",{value:R.a.HTML,children:"Simple HTML Form-based Authentication"}),Object(d.jsx)("option",{value:R.a.CSRF,children:"Simple CSRF-based Authentication"}),Object(d.jsx)("option",{value:R.a.DOM_BASED_CSRF,children:"DOM based CSRF Authentication"}),Object(d.jsx)("option",{value:R.a.OIDC,children:"Simple OIDC-based Authentication"})]})]}),G&&Object(d.jsxs)("div",{children:[Object(d.jsxs)("p",{children:[Object(d.jsx)("b",{children:"client_id:"})," ",G.clientId]}),Object(d.jsxs)("p",{children:[Object(d.jsx)("b",{children:"client_secret:"})," ",G.clientSecret]}),Object(d.jsxs)("p",{children:[Object(d.jsx)("b",{children:"Openid-configuration URL:"})," ",G.metadataUrl]}),Object(d.jsx)("br",{})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Email"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"user",placeholder:"Email",value:j,onInput:Q})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Password"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"password",name:"password",placeholder:"Password",value:m,onInput:Q})]}),(T===R.a.CSRF||T===R.a.DOM_BASED_CSRF)&&D&&Object(d.jsx)("input",{name:"xsrf",type:"hidden",value:D}),p&&B(p),Object(d.jsx)("br",{}),N&&U(N),Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--green m-b-20",type:"submit",children:"sign in"})]}),Object(d.jsxs)("div",{children:[k&&Object(d.jsx)("div",{className:"error-text",children:k}),Object(d.jsx)("b",{children:"Hint"}),": if you are looking for an authentication protected endpoint, try using:",Object(d.jsx)("a",{href:"https://brokencrystals.com/api/products",children:"https://brokencrystals.com/api/products"})]}),Object(d.jsx)("div",{className:"register-link",children:Object(d.jsxs)("p",{children:["Don't have an account?"," ",Object(d.jsx)(u.a,{to:r.a.Register,children:"Sign Up Here"})]})})]})})},z={user:"",password:"",op:R.a.BASIC},G=function(){var e=Object(c.useState)(z),t=Object(o.a)(e,2),a=t[0],n=t[1],s=a.user,i=Object(c.useState)(),j=Object(o.a)(i,2),m=j[0],b=j[1];return Object(d.jsx)(P,{children:Object(d.jsxs)("div",{className:"login-form",children:[Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault();Object(l.k)(a.user,{headers:{"content-type":"application/x-www-form-urlencoded"}}).then((function(e){return e})).then((function(e){var t=e.email;t?(sessionStorage.setItem("email",t),window.location.href=r.a.PasswordCheck):b("User doesn`t exist, try to signup")}))},children:[Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Email"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"user",placeholder:"Email",value:s,onInput:function(e){var t=e.target,c=t.name,s=t.value;n(Object(f.a)(Object(f.a)({},a),{},Object(x.a)({},c,s)))}})]}),Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--green m-b-20",type:"submit",children:"Enter password"})]}),Object(d.jsxs)("div",{children:[m&&Object(d.jsx)("div",{className:"error-text",children:m}),Object(d.jsx)("b",{children:"Hint"}),": if you are looking for an authentication protected endpoint, try using:",Object(d.jsx)("a",{href:"https://brokencrystals.com/api/products",children:"https://brokencrystals.com/api/products"})]}),Object(d.jsx)("div",{className:"register-link",children:Object(d.jsxs)("p",{children:["Don't have an account?"," ",Object(d.jsx)(u.a,{to:r.a.Register,children:"Sign Up Here"})]})})]})})},J={email:"",firstName:"",lastName:"",company:"",cardNumber:"",phoneNumber:"",password:"",op:R.a.BASIC},Q=function(){var e=Object(c.useState)(J),t=Object(o.a)(e,2),a=t[0],n=t[1],s=a.email,i=a.firstName,j=a.lastName,m=a.password,b=a.company,h=a.cardNumber,p=a.phoneNumber,O=Object(c.useState)(),g=Object(o.a)(O,2),v=g[0],N=g[1],w=Object(c.useState)(),S=Object(o.a)(w,2),y=S[0],k=S[1],I=Object(c.useState)(R.a.BASIC),C=Object(o.a)(I,2),q=C[0],T=C[1],A=Object(c.useState)(!1),E=Object(o.a)(A,2),F=E[0],L=E[1],U=function(e){var t=e.target,c=t.name,s=t.value;n(Object(f.a)(Object(f.a)({},a),{},Object(x.a)({},c,s)))};return Object(d.jsx)(P,{children:Object(d.jsxs)("div",{className:"login-form",children:[Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault(),console.log("click"),L(!0),Object(l.u)(a).then((function(e){e.errorText?(k(e.errorText),L(!1)):(N(e),setTimeout((function(){window.location.href=r.a.Login}),1500))}))},children:[Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Registration Type"}),Object(d.jsxs)("select",{className:"form-control",name:"op",placeholder:"Authentication Type",value:q,onChange:function(e){var t=e.target.value;n(Object(f.a)(Object(f.a)({},a),{},{op:t})),T(t)},children:[Object(d.jsx)("option",{value:R.a.BASIC,children:"Simple REST-based Registration"}),Object(d.jsx)("option",{value:R.a.OIDC,children:"Simple OIDC-based Registration"})]})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"First name"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"firstName",placeholder:"First name",value:i,onInput:U})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Last name"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"lastName",placeholder:"Last name",value:j,onInput:U})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Company"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"company",placeholder:"Company",value:b,onInput:U})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Card number"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"cardNumber",placeholder:"Card number",value:h,onInput:U})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Phone number"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"phoneNumber",placeholder:"Phone number",value:p,onInput:U})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Email Address"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"email",placeholder:"Email",value:s,onInput:U})]}),y&&Object(d.jsx)("div",{className:"error-text",children:y}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Password"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"password",name:"password",placeholder:"Password",value:m,onInput:U})]}),v&&D(v),Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--green m-b-20",type:"submit",disabled:F,children:"register"})]}),Object(d.jsx)("div",{className:"register-link",children:Object(d.jsxs)("p",{children:["Already have an account? ",Object(d.jsx)(u.a,{to:r.a.Login,children:"Sign In"})]})})]})})},V={email:"",firstName:"",lastName:"",id:"",company:""},K=function(){var e=sessionStorage.getItem("email")||localStorage.getItem("email"),t=Object(c.useState)(V),a=Object(o.a)(t,2),n=a[0],s=a[1],u=Object(c.useState)(!1),j=Object(o.a)(u,2),m=j[0],b=j[1],h=function(e){var t=e.target,a=t.name,c=t.value;s(Object(f.a)(Object(f.a)({},n),{},Object(x.a)({},a,c)))};Object(c.useEffect)((function(){e&&(Object(l.k)(e).then((function(e){return s(e)})),Object(l.a)(e).then((function(e){return b(!!e.isAdmin)})))}),[]);return Object(d.jsx)(d.Fragment,{children:e?Object(d.jsx)(P,{children:Object(d.jsxs)("div",{className:"login-form",children:[Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault(),Object(l.x)(n).then((function(){localStorage.getItem("email")?localStorage.setItem("userName","".concat(n.firstName," ").concat(n.lastName)):sessionStorage.setItem("userName","".concat(n.firstName," ").concat(n.lastName)),window.location.href=r.a.Home}))},children:[Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Email"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"email",placeholder:"Email",value:n.email,onInput:h})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"FirstName"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"firstName",placeholder:"FName",value:n.firstName,onInput:h})]}),Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"LastName"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"text",name:"lastName",placeholder:"LName",value:n.lastName,onInput:h})]}),Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--green m-b-20",type:"submit",children:"Save changes"})]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--blue m-b-20",onClick:function(){return Object(l.y)(n.id,m)},children:"Remove user profile photo"})})]})}):Object(d.jsx)(i.a,{to:{pathname:r.a.Login,state:{from:"/userprofile"}}})})},W=function(e){var t=e.children;return Object(d.jsx)("div",{className:"page-content--bge5",children:Object(d.jsx)("div",{className:"container",children:Object(d.jsx)("div",{className:"admin-wrap",children:Object(d.jsxs)("div",{className:"admin-content",children:[Object(d.jsx)("div",{className:"admin-logo",children:Object(d.jsxs)("a",{href:"/",className:"logo mr-auto",children:[Object(d.jsx)("img",{width:100,height:100,src:"assets/img/logo_blue.png",alt:"",className:"img-fluid"}),"BROKEN CRYSTALS"]})}),t]})})})})},X=function(){var e=sessionStorage.getItem("email")||localStorage.getItem("email"),t=Object(c.useState)(!1),a=Object(o.a)(t,2),n=a[0],s=a[1],i=Object(c.useState)(""),r=Object(o.a)(i,2),u=r[0],j=r[1],m=Object(c.useState)([]),b=Object(o.a)(m,2),h=b[0],p=b[1];return Object(c.useEffect)((function(){e&&(Object(l.a)(e).then((function(e){return s(!!e.isAdmin)})),Object(l.z)(u).then((function(e){p(e)})))}),[e,u]),Object(d.jsx)(W,{children:n?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("div",{children:"User catalog:"}),Object(d.jsxs)("div",{children:[Object(d.jsx)("b",{children:"Hint"}),": to see more results typing specific name"]}),Object(d.jsx)("input",{type:"text",className:"au-input au-input--full",placeholder:"Start typing name",onChange:function(e){j(e.target.value)}}),Object(d.jsx)("div",{children:h.map((function(e){return Object(d.jsxs)("div",{children:[Object(d.jsx)("b",{children:"First name:"})," ",e.firstName,", ",Object(d.jsx)("b",{children:"Last name:"})," ",e.lastName,",",Object(d.jsx)("b",{children:"e-mail:"})," ",e.email,", ",Object(d.jsx)("b",{children:"company:"})," ",e.company]},e.id)}))})]}):Object(d.jsx)("div",{children:"This page is forbidden for you"})})},Z={user:"",password:"",op:R.a.BASIC},$=function(){var e=Object(c.useState)(Z),t=Object(o.a)(e,2),a=t[0],n=t[1],s=a.password,i=Object(c.useState)(),j=Object(o.a)(i,2),m=j[0],b=j[1],h=sessionStorage.getItem("email"),p=function(e){var t=e.target,c=t.name,s=t.value;n(Object(f.a)(Object(f.a)({},a),{},Object(x.a)({},c,s)))};return Object(c.useEffect)((function(){h&&n(Object(f.a)(Object(f.a)({},a),{},{user:h}))}),[]),Object(d.jsx)(P,{children:Object(d.jsxs)("div",{className:"login-form",children:[Object(d.jsxs)("form",{onSubmit:function(e){e.preventDefault();Object(l.j)(a,{headers:{"content-type":"application/json"}}).then((function(e){return e})).then((function(e){var t=e.email,c=e.errorText;return c?b(c):a.rememberuser&&(localStorage.setItem("email",sessionStorage.getItem("email")||""),localStorage.setItem("token",sessionStorage.getItem("token")||""),sessionStorage.clear()),Object(l.k)(t)})).then((function(e){a.rememberuser?localStorage.setItem("userName","".concat(e.firstName," ").concat(e.lastName)):sessionStorage.setItem("userName","".concat(e.firstName," ").concat(e.lastName)),window.location.href=r.a.Home}))},children:[Object(d.jsxs)("div",{className:"form-group",children:[Object(d.jsx)("label",{children:"Username:"}),Object(d.jsx)("input",{value:a.user,name:"user",readOnly:!0}),Object(d.jsx)("label",{children:"Enter Password:"}),Object(d.jsx)("input",{className:"au-input au-input--full",type:"password",name:"password",placeholder:"Password",value:s,onInput:p}),Object(d.jsxs)("label",{htmlFor:"rememberuser",children:[Object(d.jsx)("input",{type:"checkbox",id:"rememberuser",name:"rememberuser",value:"true",onChange:p}),"\xa0Remember me"]})]}),Object(d.jsx)("button",{className:"au-btn au-btn--block au-btn--green m-b-20",type:"submit",children:"sign in"})]}),Object(d.jsxs)("div",{children:[m&&Object(d.jsx)("div",{className:"error-text",children:m}),Object(d.jsx)("b",{children:"Hint"}),": if you are looking for an authentication protected endpoint, try using:",Object(d.jsx)("a",{href:"https://brokencrystals.com/api/products",children:"https://brokencrystals.com/api/products"})]}),Object(d.jsx)("div",{className:"register-link",children:Object(d.jsxs)("p",{children:["Don't have an account?"," ",Object(d.jsx)(u.a,{to:r.a.Register,children:"Sign Up Here"})]})})]})})},ee=function(){return Object(d.jsx)(P,{children:Object(d.jsxs)("div",{children:[Object(d.jsx)("div",{children:"This is Admin Dashboard."}),Object(d.jsx)(d.Fragment,{children:"This page represents "}),Object(d.jsx)("a",{href:"https://owasp.org/Top10/A01_2021-Broken_Access_Control/",children:"AO1 Vertical access controls"}),Object(d.jsx)(d.Fragment,{children:" issue"})]})})},te=function(){var e=sessionStorage.getItem("email")||localStorage.getItem("email");return Object(d.jsxs)(i.d,{children:[Object(d.jsx)(i.b,{path:r.a.Login,children:Object(d.jsx)(Y,{})}),Object(d.jsx)(i.b,{path:r.a.LoginNew,children:Object(d.jsx)(G,{})}),Object(d.jsx)(i.b,{path:r.a.PasswordCheck,children:e?Object(d.jsx)($,{}):Object(d.jsx)(i.a,{to:{pathname:r.a.Home,state:{from:"/passwordcheck"}}})}),Object(d.jsx)(i.b,{path:r.a.Register,children:Object(d.jsx)(Q,{})}),Object(d.jsx)(i.b,{path:r.a.Marketplace,children:e?Object(d.jsx)(I,{preview:!1}):Object(d.jsx)(i.a,{to:{pathname:r.a.Login,state:{from:"/marketplace"}}})}),Object(d.jsx)(i.b,{path:r.a.Userprofile,children:e?Object(d.jsx)(K,{}):Object(d.jsx)(i.a,{to:{pathname:r.a.Login,state:{from:"/userprofile"}}})}),Object(d.jsx)(i.b,{path:r.a.Adminpage,children:e?Object(d.jsx)(X,{}):Object(d.jsx)(i.a,{to:{pathname:r.a.Home,state:{from:"/adminpage"}}})}),Object(d.jsx)(i.b,{path:r.a.Dashboard,children:e?Object(d.jsx)(ee,{}):Object(d.jsx)(i.a,{to:{pathname:r.a.Home,state:{from:"/dashboard"}}})}),Object(d.jsxs)(i.b,{path:"*",children:[Object(d.jsx)(i.a,{to:{pathname:r.a.Home}}),Object(d.jsx)(F,{})]})]})},ae=a(10),ce=Object(ae.a)({basename:""});s.a.render(Object(d.jsx)(i.c,{history:ce,children:Object(d.jsx)(te,{})}),document.getElementById("root")),(H=void 0)&&a.e(3).then(a.bind(null,122)).then((function(e){var t=e.getCLS,a=e.getFID,c=e.getFCP,n=e.getLCP,s=e.getTTFB;t(H),a(H),c(H),n(H),s(H)}))},3:function(e,t,a){"use strict";a.d(t,"n",(function(){return u})),a.d(t,"h",(function(){return d})),a.d(t,"i",(function(){return j})),a.d(t,"f",(function(){return m})),a.d(t,"c",(function(){return b})),a.d(t,"t",(function(){return h})),a.d(t,"s",(function(){return p})),a.d(t,"u",(function(){return O})),a.d(t,"j",(function(){return x})),a.d(t,"z",(function(){return f})),a.d(t,"k",(function(){return g})),a.d(t,"d",(function(){return v})),a.d(t,"o",(function(){return N})),a.d(t,"p",(function(){return w})),a.d(t,"e",(function(){return S})),a.d(t,"q",(function(){return y})),a.d(t,"g",(function(){return k})),a.d(t,"l",(function(){return I})),a.d(t,"y",(function(){return C})),a.d(t,"a",(function(){return q})),a.d(t,"x",(function(){return T})),a.d(t,"w",(function(){return A})),a.d(t,"m",(function(){return E})),a.d(t,"r",(function(){return F})),a.d(t,"v",(function(){return R})),a.d(t,"b",(function(){return P})),a.d(t,"A",(function(){return D}));var c,n=a(2),s=a(4),i=a(52),r=a.n(i),o=a(6);function l(e){var t="string"===typeof e?{url:e}:e;return u.request(t).then((function(e){var t=e.headers.authorization;return t&&sessionStorage.setItem("token",t),e.data})).catch((function(e){switch(e.response.status){case 401:return sessionStorage.clear(),localStorage.clear(),Object(s.a)(Object(s.a)({},e),{},{errorText:"Authentication failed, please check your credentials and try again"});case 409:return Object(s.a)(Object(s.a)({},e),{},{errorText:"User already exists"});default:return Object(s.a)(Object(s.a)({},e),{},{errorText:"Something went wrong. Please try again later"})}}))}!function(e){e.Subscriptions="/api/subscriptions",e.Testimonials="/api/testimonials",e.Products="/api/products",e.LatestProducts="/api/products/latest",e.Users="/api/users",e.Auth="/api/auth",e.Metadata="/api/metadata",e.Goto="/api/goto",e.Render="/api/render",e.Spawn="/api/spawn",e.File="/api/file"}(c||(c={}));var u=r.a.create();function d(){return l({url:c.Testimonials,method:"get"})}function j(){return l({url:"".concat(c.Testimonials,"/count?query=").concat(encodeURIComponent("select count(1) as count from testimonial")),method:"get"})}function m(){return l({url:c.Products,method:"get",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")}})}function b(){return l({url:c.LatestProducts,method:"get"})}function h(e){return l({url:c.Testimonials,method:"post",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")},data:e})}function p(e){return l({url:"".concat(c.Subscriptions,"?email=").concat(e),method:"post"})}function O(e){return l({url:"".concat(c.Users,"/").concat(e.op),method:"post",data:e})}function x(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=e.op===o.a.HTML?L(e):e;return l(Object(s.a)({url:"".concat(c.Auth,"/login"),method:"post",data:a},t))}function f(e){return l({url:"".concat(c.Users,"/search/").concat(e),method:"get",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")}})}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(Object(s.a)({url:"".concat(c.Users,"/one/").concat(e.trim()),method:"get"},t))}function v(e){return l({url:"".concat(c.Users,"/ldap?query=").concat(encodeURIComponent(e)),method:"get"})}function N(e){return l({url:"".concat(c.Auth,"/dom-csrf-flow"),method:"get",headers:{fingerprint:e}})}function w(){return l({url:"".concat(c.Auth,"/simple-csrf-flow"),method:"get"})}function S(){return l({url:"".concat(c.Auth,"/oidc-client"),method:"get"})}function y(){return l({url:"".concat(c.Metadata),method:"post",headers:{"content-type":"text/xml"},data:'<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE child [ <!ENTITY child SYSTEM "file:///etc/passwd"> ]><child></child>'})}function k(){return l({url:"".concat(c.Spawn,"?command=pwd"),method:"get",headers:{"content-type":"text/plain"}})}function I(e){return l({url:"".concat(c.Users,"/one/").concat(e,"/photo"),method:"get",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")},responseType:"arraybuffer"})}function C(e,t){return l({url:"".concat(c.Users,"/one/").concat(e,"/photo?isAdmin=").concat(t),method:"delete",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")}})}function q(e){return l({url:"".concat(c.Users,"/one/").concat(e,"/adminpermission"),method:"get",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token")}})}function T(e){return l({url:"".concat(c.Users,"/one/").concat(e.email,"/info"),method:"put",headers:{"content-type":"application/json",authorization:sessionStorage.getItem("token")||localStorage.getItem("token")},data:e})}function A(e,t){var a=new FormData;return a.append(t,e,e.name),l({url:"".concat(c.Users,"/one/").concat(t,"/photo"),method:"put",headers:{"content-type":"image/png",authorization:sessionStorage.getItem("token")||localStorage.getItem("token")},data:a})}function E(e){return l({url:"".concat(c.Goto,"?url=").concat(e),method:"get"})}function F(e){return l({url:c.Render,method:"post",headers:{"content-type":"text/plain"},data:e})}function L(e){return Object.entries(e).reduce((function(e,t){var a=Object(n.a)(t,2),c=a[0],s=a[1];return e.append(c,s),e}),new URLSearchParams)}function R(e,t){return l({url:"".concat(c.File,"/raw?path=").concat(e),method:"put",headers:{"content-type":"file/*"},data:t})}function P(e){return l({url:"".concat(c.File,"/raw?path=").concat(e),method:"get",headers:{"content-type":"file/*"}})}function D(e){return l({url:"".concat(c.Products,"/views"),method:"get",headers:{authorization:sessionStorage.getItem("token")||localStorage.getItem("token"),"x-product-name":e}})}},5:function(e,t,a){"use strict";var c;a.d(t,"a",(function(){return c})),function(e){e.Home="/",e.Login="/userlogin",e.LoginNew="/newuserlogin",e.PasswordCheck="/passwordcheck",e.Register="/usersignup",e.Marketplace="/marketplace",e.Userprofile="/userprofile",e.Adminpage="/adminpage",e.Dashboard="/dashboard"}(c||(c={}))},53:function(e,t,a){"use strict";(function(e){var c=a(2),n=a(1),s=a(9),i=a(54),r=a.n(i),o=a(3),l=a(5),u=a(0);t.a=function(){var t=sessionStorage.getItem("email")||localStorage.getItem("email"),a=sessionStorage.getItem("userName")||localStorage.getItem("userName"),i=Object(n.useState)(),d=Object(c.a)(i,2),j=d[0],m=d[1];Object(n.useEffect)((function(){b()}),[]);var b=function(){if(!t)return null;Object(o.l)(t).then((function(t){var a=e.from(t,"binary").toString("base64");r.a.fromBuffer(t).then((function(e){a&&m("data: ".concat((null===e||void 0===e?void 0:e.mime)||"image/svg+xml","; base64, ").concat(a))}))}))};return Object(u.jsx)(u.Fragment,{children:t?Object(u.jsxs)(u.Fragment,{children:[Object(u.jsx)("label",{htmlFor:"file-input",className:"file-input-label",children:Object(u.jsx)("img",{src:j||"assets/img/profile.png",alt:"",className:"profile-image"})}),Object(u.jsxs)(s.a,{to:l.a.Home,className:"get-started-btn scrollto",onClick:function(){sessionStorage.clear(),localStorage.clear(),window.location.reload()},children:["Log out ",a]}),Object(u.jsx)("input",{id:"file-input",type:"file",accept:"image/x-png",style:{display:"none"},onChange:function(e){var a=e.target.files[0];if(!a||!t)return null;Object(o.w)(a,t).then((function(){return b()}))}})]}):Object(u.jsxs)(u.Fragment,{children:[Object(u.jsx)("a",{href:"".concat(l.a.Login,"?logobgcolor=transparent"),className:"get-started-btn scrollto",children:"Sign in"}),Object(u.jsx)("a",{href:l.a.LoginNew,className:"get-started-btn scrollto",children:"2-step Sign in"})]})})}}).call(this,a(24).Buffer)},6:function(e,t,a){"use strict";var c;a.d(t,"a",(function(){return c})),function(e){e.BASIC="basic",e.HTML="html",e.CSRF="csrf",e.DOM_BASED_CSRF="csrf_dom",e.OIDC="oidc"}(c||(c={}))}},[[121,1,2]]]);
//# sourceMappingURL=main.d0e39dc9.chunk.js.map

External links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants