"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[81696],{183989:(e,a,t)=>{t.d(a,{aQ:()=>u,bB:()=>c});var r=t(489050),s=t(789768),n=t(953141),o=t(16795);const i=e=>({error:e,type:o.ID}),c=()=>e=>{r.K.post("/api/logout").then(()=>e((0,s.oX)()))},u=e=>async a=>{await a({type:o.V8});try{return await r.K.post("/api/login",{strict:!0,...e}),a(async e=>e({type:o.FE}))}catch(e){const{response:t}=e;if(400===t?.status&&t?.data)switch(t.data?.meta?.msg){case n.U.apiErrUbic2faTokenRequired:return a(((e=!1)=>({type:o.HH,payload:{require2Fa:e}}))(!0));case n.U.apiErrInvalid2FAToken:return a(i("COMMON_VALIDATION_INVALID_2FA_TOKEN"))}return a(i(400===t?.status?"COMMON_VALIDATION_INVALID_USERNAME_OR_PASSWORD":"COMMON_NOTICE_REQUEST_ERROR"))}}},489050:(e,a,t)=>{t.d(a,{K:()=>i,o:()=>o});var r=t(272505),s=t.n(r);const n=s().create({baseURL:"/",withCredentials:!0,xsrfCookieName:"csrf_token",xsrfHeaderName:"X-Csrf-Token"}),o=s().create();n.interceptors.response.use(e=>e.data&&e.data instanceof ArrayBuffer?e:{...e,data:e.data.data,meta:e.data.meta});const i=n},719713:(e,a,t)=>{t.r(a),t.d(a,{default:()=>A});var r=t(868238),s=t(469733),n=t(951272),o=t(870443),i=t(108916),c=t(183989),u=t(296540),d=t(451919),l=t(510497),p=t(187483);const O=({isAuthenticated:e,redirectPath:a})=>{const t=(0,s.useSelector)(p.TP),r=(0,s.useSelector)(p.W1),n=(0,u.useCallback)(e=>(l.u.removeItem(d.lP.HOTSPOT_LOGOUT_SITE_NAME),r?`/${e?"manage/hotspot-manager":"manage"}/account/login${e?`/${e}`:""}`:`/login?redirect=${`${t}${a}`.replace(/(\/){2,}/,"/")}`),[t,r,a]);return(0,u.useEffect)(()=>{e&&(window.location.href=n(l.u.getItem(d.lP.HOTSPOT_LOGOUT_SITE_NAME)))},[n,e]),null},_={authLogin:c.aQ},A=(0,r.Zz)((0,s.connect)(e=>({error:(0,i.uF)(e),require2Fa:(0,i.o4)(e)}),_),(0,n.bk)({handleSubmit:(e,{props:{authLogin:a}})=>{a(e)},mapPropsToValues:()=>({password:"",remember:!0,username:"",ubic_2fa_token:void 0}),validationSchema:o.A.object().shape({password:o.A.string().label("COMMON_PASSWORD").required(),username:o.A.string().label("COMMON_LABEL_USERNAME").required()})}))(O)}}]);