1import{a as te}from"./chunk-XRUVHNL3.js";import{M as H,N as z,Pb as ee,a as V,b as S,c as A,d as N,ea as Z,fa as J,h as D,ha as K,k as B,la as F,n as L,na as X,q as O,r as j,s as Q,sb as $,ub as b}from"./chunk-RWNNQ546.js";import"./chunk-KNHHVHUS.js";import{L as v,N as W}from"./chunk-WKSYFLSH.js";import{Ea as o,Fc as M,Ib as l,Ja as h,Jb as f,Kb as P,Oa as R,db as m,eb as u,ga as g,ha as x,id as T,jb as d,je as Y,kb as a,kd as q,lb as s,mb as C,qb as y,sb as E,tb as c,xb as G,yb as I,zb as k}from"./chunk-CXYZGYWA.js";import"./chunk-3ENMYILF.js";import"./chunk-TWZW5B45.js";var ie=["userGrid"];function se(r,p){if(r&1&&(a(0,"div",1)(1,"div",2)(2,"h3"),l(3),s()()()),r&2){let e=c();o(3),f(e.text)}}function oe(r,p){if(r&1&&(a(0,"form",6)(1,"div",1)(2,"div",8),C(3,"lib-dcs-combo-box",9),s()()()),r&2){let e=c(3);d("formGroup",e.mainLoginUserForm),o(3),d("formGroup",e.mainLoginUserForm)("dcsOptions",e.dataSource.data)}}function ae(r,p){if(r&1&&(a(0,"div"),m(1,oe,4,3,"form",6),s()),r&2){let e=c(2);o(),u(e.checkScuba6Upgraded()&&e.dataSource.data[0].ldap_user==0?1:-1)}}function ne(r,p){if(r&1&&(a(0,"div",1)(1,"div",2)(2,"div")(3,"p",7),l(4),s()(),m(5,ae,2,1,"div"),s()()),r&2){let e=c();o(4),f(e.text),o(),u(e.dataSource.data.length>0?5:-1)}}function le(r,p){if(r&1&&(a(0,"label",14)(1,"i",15),l(2),s(),l(3),s()),r&2){let e=c(3);d("ngClass",e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("minlength")?"text-danger":"text-success"),o(2),f(e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("minlength")?"cancel":"check_circle"),o(),P(" Must be at least ",e.sites[0].password_min," characters! ")}}function de(r,p){if(r&1&&(a(0,"label",14)(1,"i",15),l(2),s(),l(3," Must contain at least 1 number! "),s()),r&2){let e=c(3);d("ngClass",e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasNumber")?"text-danger":"text-success"),o(2),f(e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasNumber")?"cancel":"check_circle")}}function ce(r,p){if(r&1&&(a(0,"label",14)(1,"i",15),l(2),s(),l(3," Must contain at least 1 capital letter! "),s()),r&2){let e=c(3);d("ngClass",e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasCapitalCase")?"text-danger":"text-success"),o(2),f(e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasCapitalCase")?"cancel":"check_circle")}}function me(r,p){if(r&1&&(a(0,"label",14)(1,"i",15),l(2),s(),l(3," Must contain at least 1 lower case letter! "),s()),r&2){let e=c(3);d("ngClass",e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasSmallCase")?"text-danger":"text-success"),o(2),f(e.passwordForm.controls.password.hasError("required")||e.passwordForm.controls.password.hasError("hasSmallCase")?"cancel":"check_circle")}}function ue(r,p){if(r&1&&(a(0,"div",2),m(1,le,4,3,"label",14),m(2,de,4,2,"label",14),m(3,ce,4,2,"label",14),m(4,me,4,2,"label",14),s()),r&2){let e=c(2);o(),u(e.sites[0].password_min>0?1:-1),o(),u(e.sites[0].password_format_number==1?2:-1),o(),u(e.sites[0].password_format_upper==1?3:-1),o(),u(e.sites[0].password_format_lower==1?4:-1)}}function pe(r,p){if(r&1){let e=y();a(0,"form",6)(1,"div",1)(2,"div",2),C(3,"lib-dcs-input",10),s()(),a(4,"div",11)(5,"div",1),m(6,ue,5,4,"div",2),s()(),a(7,"div",1)(8,"div",2),C(9,"lib-dcs-input",12),s()(),a(10,"div",1)(11,"div",2)(12,"button",13),E("click",function(){g(e);let i=c();return x(i.savePassword())}),l(13," Continue "),s()()()()}if(r&2){let e=c();d("formGroup",e.passwordForm),o(3),d("formGroup",e.passwordForm),o(3),u(e.sites[0].password_format==1?6:-1),o(3),d("formGroup",e.passwordForm),o(3),d("disabled",!e.isFormValid())}}var ke=(()=>{class r{ngOnDestroy(){this.unsubscribeFromFormSubscriptions()}unsubscribeFromFormSubscriptions(){this.formControlSubscriptions.forEach(e=>e.unsubscribe()),this.formControlSubscriptions=[]}constructor(e,t,i,n,w,_,re){this.stellar3UserService=e,this.route=t,this.stellar3
1CommonService=i,this.fb=n,this.modalPopupService=w,this.stellar3EmailService=_,this.router=re,this.sites=new Array,this.ePassword="",this.ePassword2="",this.dataSource=new F,this.selectedUsers=new Array,this.text="",this.archiveText="",this.upgraded=!1,this.newMemberText="",this.membersToArchive=new Array,this.userGridColumns=[{key:"isSelected",type:"isSelected",label:"",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"email",type:"text",label:"Email",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"forename",type:"text",label:"Forename",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"surname",type:"text",label:"Surname",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"reference",type:"number",label:"Reference",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"category_name",type:"text",label:"Category Name",allowEdit:!1,hidden:!1,export:!1,cellStyle:""},{key:"status",type:"text",label:"Status",allowEdit:!1,hidden:!1,export:!1,cellStyle:""}],this.selection=new J(!0,[]),this.formControlSubscriptions=[],this.reqId=this.route.snapshot.params.requestId,this.stellar3UserService.getResetValid(this.reqId).then(U=>{U.records.length>0?this.userGuid=U.records[0].user_guid:this.text="Sorry, your password reset link has expired, please reset your password again"})}ngOnInit(){this.mainLoginUserForm=this.fb.group({mainUser:[null]}),this.stellar3CommonService.readSites().then(e=>{this.sites=e.records.map(t=>{var i="0000"+(+t.password_format).toString(2);let n=i.substring(i.length-4);return t.password_format=n[0],t.password_format_upper=n[1],t.password_format_lower=n[2],t.password_format_number=n[3],t}),this.passwordForm=this.createPasswordForm(),this.passwordForm.controls.confirmPassword.addValidators($(this.passwordForm,"password","confirmPassword",!1)),this.formControlSubscriptions.push(this.passwordForm.controls.password.valueChanges.subscribe(t=>{this.ePassword=t}),this.passwordForm.controls.confirmPassword.valueChanges.subscribe(t=>{this.ePassword2=t}))}),this.getEmailResetList()}createPasswordForm(){return this.fb.group({password:[null,S.compose([S.required,b(/\d/,{hasNumber:!0},this.sites[0].password_format_number),b(/[A-Z]/,{hasCapitalCase:!0},this.sites[0].password_format_upper),b(/[a-z]/,{hasSmallCase:!0},this.sites[0].password_format_lower),S.minLength(this.sites[0].password_min)])],confirmPassword:[null,S.required]})}savePassword(){var e=this.selectedUsers.findIndex(t=>t.user_guid==this.dataSource.data[0].user_guid);if(e==-1){let t={};t.data={description:"Warning",showCancelBtn:!1,subtitle:"You cannot archive the master member ("+this.dataSource.data[0].forename+" "+this.dataSource.data[0].surname+" - "+this.dataSource.data[0].reference+"). Please reselect the first member in the list.",confirmCaption:"Back"};let i=this.modalPopupService.openSmallPopup(v,t.data,"mainUserArchive")}else this.stellar3UserService.resetPassword(this.ePassword,this.ePassword2,this.dataSource.data[0].user_guid).then(t=>{t.data=="Password Changed"&&this.stellar3EmailService.writeScuba6Email(this.dataSource.data[0].user_guid,23,null,null,null,null,null,null,null).then(()=>{this.stellar3EmailService.queueEmail(23,null).then(()=>{if(this.stellar3EmailService.sendEmail(),this.dataSource.data.length>1&&this.selectedUsers.length!=this.dataSource.data.length&&(this.membersToArchive=this.dataSource.data.filter(i=>!this.selectedUsers.some(n=>i.user_guid===n.user_guid))),this.membersToArchive.length>0){let i={};i.data={description:"Confirm",subtitle:"You have chosen to archive some of your users, you can only reactivate the users if you follow the forgotten password link again. Are you sure you wish to archive these users now?",showMiddleBtn:!1,showCancelBtn:!0,showOkBtn:!0,confirmCaption:"Archive Users",cancelCaption:"No"},this.modalPopupService.openSmallPopup(v,i.data,"archiveConfirmation").afterClosed().subscribe(w=>{w=="dcsOk"?this.archiveUsers():this.setMasterGuid()})}else this.setMasterGuid()})})})}archiveUsers(){this.membersToArchive.forEach(e=>{e.user_guid!=this.dataSource.data[0].user_guid&&this.stellar3UserService.archiveUserGuid(this.reqId,e.user_guid)}),this.setMasterGuid()}setMasterGuid(){this.dataSource.data[0].length==1?this.stellar3UserService.setMasterGuid(this.reqId,this.dataSource.data[0].user_guid).then(()=>{this.confirmation()}):this.stellar3UserService.setMasterGuid(this.reqId,this.mainLoginUserForm.controls.mainUser.value).then(()=>{this.confirmation()})}confirmation(){let e={};e.data={description:"Password Changed",subtitle:"You have successfully changed your password. An email confirmation has been sent.",showMiddleBtn:!1,showCancelBtn:!0,showOkBtn:!1,confirmCaption:"Archive Users",cancelCaption:"Close"},this.modalPopupService.openSmallPopup(v,e.data,"archiveConfirmation").afterClosed().subscribe(i=>{this.router.navigate(["/"])})}isFormValid(){return this.passwordForm?this.passwordForm.valid:!1}selectRow(e){var t=this.selectedUsers.findIndex(i=>i.user_guid==this.dataSource.data[0].user_guid);if(t==-1){let i={};i.data={description:"Warning",showCancelBtn:!1,subtitle:"You cannot ar
1chive the master member ("+this.dataSource.data[0].forename+" "+this.dataSource.data[0].surname+" - "+this.dataSource.data[0].reference+"). We have reselected the member for you.",confirmCaption:"Back"};let n=this.modalPopupService.openSmallPopup(v,i.data,"mainUserArchive");this.userGrid.selectHandler(e,0)}}selectionChanged(e){this.selectedUsers=e.selected}getEmailResetList(){this.stellar3UserService.getEmailResetList(this.reqId).then(e=>{this.dataSource=new F(e.records),this.dataSource.data.forEach(t=>{t.userInfo=t.forename+" "+t.surname+" - "+t.category_name+" - "+t.reference}),this.userGrid&&setTimeout(()=>this.userGrid.selectAll(),10),this.text="Hi "+e.records[0].forename,this.mainLoginUserForm.controls.mainUser.setValue(this.dataSource.data[0].user_guid),e.records.length>1&&(this.checkScuba6Upgraded()||(this.text+=", there are multiple memberships with your email on the system."),this.checkScuba6Upgraded()&&e.records[0].ldap_user==0&&(this.text+=`, there are multiple records associated with your email address. 2Please select the member you would like to be the main user, this record will be the default member when logging in.`),this.archiveText="Please deselect any of the memberships that you no longer use."),this.dataSource.data[0].ldap_user==1&&this.mainLoginUserForm.controls.mainUser.disable()})}checkScuba6Upgraded(){return this.dataSource.data.forEach(e=>{e.scuba6_upgraded==1&&(this.upgraded=!0)}),this.dataSource.data.length>1&&this.upgraded==!1}static{this.\u0275fac=function(t){return new(t||r)(h(z),h(T),h(te),h(O),h(W),h(H),h(q))}}static{this.\u0275cmp=R({type:r,selectors:[["app-stellar3-password-reset"]],viewQuery:function(t,i){if(t&1&&G(ie,5),t&2){let n;I(n=k())&&(i.userGrid=n.first)}},decls:20,vars:7,consts:[["userGrid",""],[1,"row"],[1,"col-12"],["id","availableItems","dcsAction","false","dcsSelectSingle","false","dcsSelectPrevious","false",1,"col-sm-3",3,"onSelectionChanged","onRowSelected","dcsModel","dcsGridSchema"],[1,"p-2"],[1,"col-12","col-lg-6"],[3,"formGroup"],[2,"white-space","pre-wrap"],[1,"col-lg-4","col-sm-12"],["dcsParent","constructor.name","formControlName","mainUser","dcsOptId","user_guid","dcsOptDesc","userInfo","dcsText","Main user","dcsIconName","filter",3,"formGroup","dcsOptions"],["dcsParent","constructor.name","dcsText","New Password","type","text","ngDefaultControl","","formControlName","password","id","password1","aria-labelledby","password1",3,"formGroup"],[1,"m-3"],["dcsParent","constructor.name","dcsText","Confirm Password","type","text","ngDefaultControl","","formControlName","confirmPassword","id","password2","aria-labelledby","password2",3,"formGroup"],["tabindex","-1","mat-raised-button","","color","primary",1,"btn-margin","float-end",3,"click","disabled"],[1,"col-12",3,"ngClass"],[1,"material-icons"]],template:function(t,i){if(t&1){let n=y();m(0,se,4,1,"div",1),m(1,ne,6,2,"div",1),a(2,"div",1)(3,"div",2),C(4,"hr"),s()(),a(5,"div",1)(6,"div",2)(7,"p"),l(8),s(),a(9,"lib-dcs-grid",3,0),E("onSelectionChanged",function(_){return g(n),x(i.selectionChanged(_))})("onRowSelected",function(_){return g(n),x(i.selectRow(_))}),s()(),a(11,"p"),l(12),s()(),a(13,"div",1)(14,"div",2)(15,"h2",4),l(16,"New Password"),s()()(),a(17,"div",1)(18,"div",5),m(19,pe,14,5,"form",6),s()()}t&2&&(u(i.userGuid?-1:0),o(),u(i.userGuid?1:-1),o(7),f(i.archiveText),o(),d("dcsModel",i.dataSource)("dcsGridSchema",i.userGridColumns),o(3),P(" ",i.dataSource.data.length-i.selectedUsers.length," member(s), will be archived. "),o(7),u(i.passwordForm?19:-1))},dependencies:[ee,X,Y,M,D,V,A,N,Z,K,j,Q,B,L],encapsulation:2})}}return r})();export{ke as Stellar3PasswordResetComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.