"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[81696],{181871(e,a,t){t.r(a),t.d(a,{default:()=>l});var r=t(418398),s=t(977872),n=t(843871),i=t(950804),o=t(258881),u=t(35332),c=t(602086),d=t(482748),p=t(607856),O=t(976458);const l=(0,r.Zz)((0,s.Ng)(e=>({error:(0,o.uF)(e),require2Fa:(0,o.o4)(e)}),{authLogin:u.aQ}),(0,n.bk)({handleSubmit:(e,{props:{authLogin:a}})=>{a(e)},mapPropsToValues:()=>({password:"",remember:!0,username:"",ubic_2fa_token:void 0}),validationSchema:i.A.object().shape({password:i.A.string().label("COMMON_PASSWORD").required(),username:i.A.string().label("COMMON_LABEL_USERNAME").required()})}))(({isAuthenticated:e,redirectPath:a})=>{const t=(0,s.d4)(O.TP),r=(0,s.d4)(O.W1),n=(0,c.useCallback)(e=>(p.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,c.useEffect)(()=>{e&&(window.location.href=n(p.u.getItem(d.lP.HOTSPOT_LOGOUT_SITE_NAME)))},[n,e]),null})},35332(e,a,t){t.d(a,{aQ:()=>c,bB:()=>u});var r=t(197003),s=t(158402),n=t(352210),i=t(608958);const o=e=>({error:e,type:i.ID}),u=()=>e=>{r.K.post("/api/logout").then(()=>e((0,s.oX)()))},c=e=>async a=>{await a({type:i.V8});try{return await r.K.post("/api/login",{strict:!0,...e}),a(async e=>e({type:i.FE}))}catch(e){const{response:t}=e;if(400===t?.status&&t?.data)switch(t.data?.meta?.msg){case n.ApiString.apiErrUbic2faTokenRequired:return a(((e=!1)=>({type:i.HH,payload:{require2Fa:e}}))(!0));case n.ApiString.apiErrInvalid2FAToken:return a(o("COMMON_VALIDATION_INVALID_2FA_TOKEN"))}return a(o(400===t?.status?"COMMON_VALIDATION_INVALID_USERNAME_OR_PASSWORD":"COMMON_NOTICE_REQUEST_ERROR"))}}},197003(e,a,t){t.d(a,{K:()=>o,o:()=>i});var r=t(989181),s=t.n(r);const n=s().create({baseURL:"/",withCredentials:!0,xsrfCookieName:"csrf_token",xsrfHeaderName:"X-Csrf-Token"}),i=s().create();n.interceptors.response.use(e=>e.data&&e.data instanceof ArrayBuffer?e:{...e,data:e.data.data,meta:e.data.meta});const o=n}}]);