"use strict";(self.webpackChunkaesirx_cmp=self.webpackChunkaesirx_cmp||[]).push([[55],{20055:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var r=a(89698),s=a(87698),n=(a(24899),a(96540)),o=a(71083),l=a(9072),m=a(2376),c=({btnClass:e="",spacingClass:t="",noLabel:a=!1,forgotPasswordLink:c=""})=>{const[i,d]=(0,n.useState)(!1),{handleOnData:p,demoUser:u,demoPassword:w}=(0,n.useContext)(r.k);return n.createElement("form",{onSubmit:async e=>{e.preventDefault(),d(!0);try{const{endpoint:t,client_id:a,client_secret:r}=(0,s.NR)(),n=e.target,l=new FormData(n),c="undefined"!=typeof window&&window.location.search,i=new URLSearchParams(c),u=i.get("organisationId"),w=i.get("return"),b=i.get("channel_type"),h={username:l.get("ssoemail"),password:l.get("ssoepassword"),client_id:a,client_secret:r,grant_type:"password",...b&&{channel_type:b},...w&&{return:w},...u&&{organisationId:u}},g={method:"post",url:`${t}/index.php?webserviceClient=site&webserviceVersion=1.0.0&option=token&api=oauth2${"noscopes"===("true"===m._K2.REACT_APP_HEADER_JWT?"noscopes":"")?"&state=noscopes":""}`,headers:{"Content-Type":"application/x-www-form-urlencoded"},data:h},{data:f}=await(0,o.A)(g);p(f),d(!1)}catch(e){return console.log("errorerrorerror",e),(0,l.oR)("Wrong authentication",{closeOnClick:!1}),d(!1),!1}}},u&&u&&n.createElement(n.Fragment,null,n.createElement("h5",{className:"text-primary"},"Demo email: ",u," "),n.createElement("h5",{className:"mb-3 text-primary"},"Demo password: ",w," ")),n.createElement("div",{className:`${t||"mb-4"}`},!a&&n.createElement("label",{htmlFor:"ssoemail",className:"form-label text-primary mb-2"},"Email address"),n.createElement("input",{type:"email",className:"form-control lh-sm border",name:"ssoemail",defaultValue:u})),n.createElement("div",{className:`${t||"mb-4"}`},!a&&n.createElement("label",{htmlFor:"ssoepassword",className:"form-label text-primary mb-2"},"Password"),n.createElement("input",{type:"password",className:"form-control lh-sm border",name:"ssoepassword",defaultValue:w,required:!0})),n.createElement("p",{className:`text-end ${t||"mb-4"}`},n.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:`${c||"https://dapp.shield.aesirx.io/auth/forgot-password"}`,className:"text-decoration-none"},"Forgot password ?")),n.createElement("button",{type:"submit",className:`${e||"btn btn-success w-100 lh-sm text-white fw-semibold"}`},i?n.createElement(n.Fragment,null,n.createElement("span",{className:"spinner-border spinner-border-sm me-1",role:"status","aria-hidden":"true"}),"Waiting..."):"Login"))}}}]);