import{ao as e,aq as C,az as n,aj as S,b0 as U,bc as L,dZ as j,aF as y,ah as b,L as F,cb as q}from"./app-k0jcl5PQ.js";import{C as M}from"./DiLZz1Ri.chunk.js";import{g as N}from"./CyKu8oTG.chunk.js";import{F as R}from"./C3DvQ1wU.chunk.js";import{S as V}from"./BpDDe8SM.chunk.js";import{U as l}from"./9ls1F1Ve.chunk.js";import"./DzRq1F5-.chunk.js";import"./DV1GpLCe.chunk.js";import"./Di9d6zcy.chunk.js";import"./CKctgafI.chunk.js";import"./DLmnDxSd.chunk.js";import"./CW7x8M-z.chunk.js";import"./fstW5ZQE.chunk.js";const W="userManager.changePasswordSsoWarning";function k(){return e.jsx("div",{className:"alert alert-warning",children:e.jsx(C,{namespace:W,phrase:"ssoWarning"})})}const v="userManager.changePassword",o=F.encloseNamespace(v),I={newPassword:"",confirmPassword:"",changeOnNextLogin:!0};function Q(s){var d,m,g;const c=n(S.currentUser()),a=n(l.getUser(s.userId)),i=n(c.data&&V.getCustomerSecuritySettings(c.data.customerId)),r=(d=a.data)==null?void 0:d.userType,h=(g=(m=a.data)==null?void 0:m.userProfile)==null?void 0:g.role,P=U(),u=L();function w(p){const f=l.changeUserPassword(s.userId,r,p.newPassword,p.changeOnNextLogin);P(f).then(()=>u.success(o("success"))).catch(()=>u.error(o("error"))).finally(s.closePopup)}const x=j.getMinimumPasswordLength(i.data,r,h),t=!!i.data&&!!a.data;return e.jsxs(y,{title:o("title"),closePopup:s.closePopup,showLoadingSpinner:!t,children:[!!t&&b.hasSso(a.data)&&e.jsx(k,{}),e.jsx(R,{initialValues:I,onSubmit:w,validationSchema:N(x),children:t&&e.jsx(M,{onClickCancel:s.closePopup,submitVariant:"dark",buttonContainerClass:"border-top d-flex justify-content-end align-items-center pt-3 px-3 mx-n3",showChangeOnNextLogin:r===q.Learner,hideCurrentPassword:!0})})]})}export{Q as ChangePasswordView};
//# sourceMappingURL=BmP6pyqc.chunk.js.map
