(self.webpackChunk=self.webpackChunk||[]).push([[5357],{80397:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return d}}),s(63238),s(61418),s(5769);var r=s(6594),a=s(17025),n=s(53754),o=(s(78066),s(76543)),i=s(38440),l=s(56346);function c(e,t){var r=t.userId;ApiClient.getUser(r).then((function(t){o.ZP.getCurrentUser().then((function(r){a.Z.setTitle(t.Name),e.querySelector(".username").innerHTML=t.Name;var n=!0,o=!1;"Guest"==t.ConnectLinkType?(e.querySelector(".localAccessSection").classList.add("hide"),n=!1):t.HasConfiguredPassword?(e.querySelector("#btnResetPassword").classList.remove("hide"),e.querySelector("#fldCurrentPassword").classList.remove("hide"),o=!0):(e.querySelector("#btnResetPassword").classList.add("hide"),e.querySelector("#fldCurrentPassword").classList.add("hide")),n&&(r.Policy.IsAdministrator||t.Policy.EnableUserPreferenceAccess)?e.querySelector(".passwordSection").classList.remove("hide"):e.querySelector(".passwordSection").classList.add("hide"),o&&(r.Policy.IsAdministrator||t.Policy.EnableUserPreferenceAccess)?e.querySelector(".localAccessSection").classList.remove("hide"):e.querySelector(".localAccessSection").classList.add("hide");var i=e.querySelector("#txtEasyPassword");i.value="",t.HasConfiguredEasyPassword?(i.placeholder="******",e.querySelector("#btnResetEasyPassword").classList.remove("hide")):(i.removeAttribute("placeholder"),i.placeholder="",e.querySelector("#btnResetEasyPassword").classList.add("hide")),e.querySelector(".chkEnableLocalEasyPassword").checked=t.Configuration.EnableLocalPassword,Promise.resolve().then(s.bind(s,6610)).then((function(t){t.default.autoFocus(e)}))}))})),e.querySelector("#txtCurrentPassword").value="",e.querySelector("#txtNewPassword").value="",e.querySelector("#txtNewPasswordConfirm").value=""}function d(e,t){function s(s){ApiClient.getUser(s).then((function(s){s.Configuration.EnableLocalPassword=e.querySelector(".chkEnableLocalEasyPassword").checked,ApiClient.updateUserConfiguration(s.Id,s.Configuration).then((function(){r.ZP.hide(),(0,i.Z)(n.ZP.translate("SettingsSaved")),c(e,t)}))}))}e.querySelector(".updatePasswordForm").addEventListener("submit",(function(s){var a,l,d;return this.querySelector("#txtNewPassword").value!=this.querySelector("#txtNewPasswordConfirm").value?(0,i.Z)(n.ZP.translate("PasswordMatchError")):(r.ZP.show(),a=t.userId,l=e.querySelector("#txtCurrentPassword").value,d=e.querySelector("#txtNewPassword").value,e.querySelector("#fldCurrentPassword").classList.contains("hide")&&(l=""),ApiClient.updateUserPassword(a,l,d).then((function(){r.ZP.hide(),(0,i.Z)(n.ZP.translate("PasswordSaved")),c(e,t)}),(function(){r.ZP.hide(),o.ZP.alert({title:n.ZP.translate("HeaderLoginFailure"),message:n.ZP.translate("MessageInvalidUser")})}))),s.preventDefault(),!1})),e.querySelector(".localAccessForm").addEventListener("submit",(function(a){var n,o;return r.ZP.show(),n=t.userId,(o=e.querySelector("#txtEasyPassword").value)?ApiClient.updateEasyPassword(n,o).then((function(){s(n)})):s(n),a.preventDefault(),!1})),e.querySelector("#btnResetEasyPassword").addEventListener("click",(function(){var s=n.ZP.translate("PinCodeResetConfirmation");(0,l.Z)(s,n.ZP.translate("HeaderPinCodeReset")).then((function(){var s=t.userId;r.ZP.show(),ApiClient.resetEasyPassword(s).then((function(){r.ZP.hide(),o.ZP.alert({message:n.ZP.translate("PinCodeResetComplete"),title:n.ZP.translate("HeaderPinCodeReset")}),c(e,t)}))}))})),e.querySelector("#btnResetPassword").addEventListener("click",(function(){var s=n.ZP.translate("PasswordResetConfirmation");(0,l.Z)(s,n.ZP.translate("ResetPassword")).then((function(){var s=t.userId;r.ZP.show(),ApiClient.resetUserPassword(s).then((function(){r.ZP.hide(),o.ZP.alert({message:n.ZP.translate("PasswordResetComplete"),title:n.ZP.translate("ResetPassword")}),c(e,t)}))}))})),e.addEventListener("viewshow",(function(){c(e,t)}))}}}]);