mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-11 17:50:39 +01:00
2 lines
5.7 KiB
JavaScript
Vendored
2 lines
5.7 KiB
JavaScript
Vendored
import{P as A,a as U,b as C,u as D,a2 as K,d as y,$ as L,e as p,f as _,g as w,m as a,h as n,p as E,i as s,t as u,l as g,D as b,I as V}from"./app-347ef106.js";import{F as v}from"./Form-893a9a1a.js";import{_ as R}from"./SettingTabs-e95cff9d.js";/*! 2FAuth version 5.0.3 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const M={class:"options-tabs"},W={key:0,class:"notification is-warning"},H={key:1,class:"notification is-info"},I=["onSubmit"],j=["innerHTML"],z={class:"title is-4 has-text-grey-light"},q=["disabled"],G=["onSubmit"],J={class:"title is-4 pt-6 has-text-grey-light"},O=["disabled"],Q=["onSubmit"],X={class:"title is-4 pt-6 has-text-danger"},Y={class:"field is-size-7-mobile"},Z={class:"block"},ee=["disabled"],ae={__name:"Account",setup(se){const c=A("2fauth"),d=U(),i=C(),F=D(),x=K(c.prefix+"returnTo","accounts"),l=y(new v({name:d.name,email:d.email,password:""})),t=y(new v({currentPassword:"",password:"",password_confirmation:""})),m=y(new v({password:""}));function P(r){l.put("/user",{returnError:!0}).then(e=>{d.$patch({name:e.data.name,email:e.data.email,isAdmin:e.data.is_admin}),i.success({text:V("auth.forms.profile_saved")})}).catch(e=>{e.response.status===400?i.alert({text:e.response.data.message}):e.response.status!==422&&i.error(e.response)})}function T(r){t.patch("/user/password",{returnError:!0}).then(e=>{t.password="",t.formPassword="",t.password_confirmation="",i.success({text:e.data.message})}).catch(e=>{e.response.status===400?i.alert({text:e.response.data.message}):e.response.status!==422&&i.error(e.response)})}function $(r){confirm(V("auth.confirm.delete_account"))&&m.delete("/user",{returnError:!0}).then(e=>{i.success({text:V("auth.forms.user_account_successfully_deleted")}),F.push({name:"register"})}).catch(e=>{e.response.status===400?i.alert({text:e.response.data.message}):e.response.status!==422&&i.error(e.response)})}return L(r=>{!r.name.startsWith("settings.")&&r.name==="login"&&i.clear()}),(r,e)=>{const f=p("FormField"),h=p("FormButtons"),B=p("FormPasswordField"),N=p("FormWrapper"),S=p("ButtonBackCloseCancel"),k=p("VueFooter");return _(),w("div",null,[a(R,{activeTab:"settings.account"},null,8,["activeTab"]),n("div",M,[a(N,null,{default:E(()=>[s(d).isAdmin?(_(),w("div",W,u(r.$t("settings.you_are_administrator")),1)):g("",!0),s(d).oauth_provider?(_(),w("div",H,u(r.$t("settings.account_linked_to_sso_x_provider",{provider:s(d).oauth_provider})),1)):g("",!0),n("form",{onSubmit:b(P,["prevent"]),onKeydown:e[3]||(e[3]=o=>s(l).onKeydown(o))},[s(c).config.proxyAuth?(_(),w("div",{key:0,class:"notification is-warning has-text-centered",innerHTML:r.$t("auth.user_account_controlled_by_proxy")},null,8,j)):g("",!0),n("h4",z,u(r.$t("settings.profile")),1),n("fieldset",{disabled:s(c).config.proxyAuth||s(d).oauth_provider},[a(f,{modelValue:s(l).name,"onUpdate:modelValue":e[0]||(e[0]=o=>s(l).name=o),fieldName:"name",fieldError:s(l).errors.get("name"),label:"auth.forms.name",maxLength:255,autofocus:""},null,8,["modelValue","fieldError"]),a(f,{modelValue:s(l).email,"onUpdate:modelValue":e[1]||(e[1]=o=>s(l).email=o),fieldName:"email",fieldError:s(l).errors.get("email"),inputType:"email",label:"auth.forms.email",maxLength:255,autofocus:""},null,8,["modelValue","fieldError"]),a(f,{modelValue:s(l).password,"onUpdate:modelValue":e[2]||(e[2]=o=>s(l).password=o),fieldName:"password",fieldError:s(l).errors.get("password"),inputType:"password",label:"auth.forms.current_password.label",help:"auth.forms.current_password.help"},null,8,["modelValue","fieldError"]),a(h,{isBusy:s(l).isBusy,caption:"commons.update"},null,8,["isBusy"])],8,q)],40,I),n("form",{onSubmit:b(T,["prevent"]),onKeydown:e[7]||(e[7]=o=>s(t).onKeydown(o))},[n("h4",J,u(r.$t("settings.change_password")),1),n("fieldset",{disabled:s(c).config.proxyAuth||s(d).oauth_provider},[a(B,{modelValue:s(t).password,"onUpdate:modelValue":e[4]||(e[4]=o=>s(t).password=o),fieldName:"password",fieldError:s(t).errors.get("password"),autocomplete:"new-password",showRules:!0,label:"auth.forms.new_password"},null,8,["modelValue","fieldError"]),a(B,{modelValue:s(t).password_confirmation,"onUpdate:modelValue":e[5]||(e[5]=o=>s(t).password_confirmation=o),showRules:!1,fieldName:"password_confirmation",fieldError:s(t).errors.get("password_confirmation"),inputType:"password",autocomplete:"new-password",label:"auth.forms.confirm_new_password"},null,8,["modelValue","fieldError"]),a(f,{modelValue:s(t).currentPassword,"onUpdate:modelValue":e[6]||(e[6]=o=>s(t).currentPassword=o),fieldName:"currentPassword",fieldError:s(t).errors.get("currentPassword"),inputType:"password",label:"auth.forms.current_password.label",help:"auth.forms.current_password.help"},null,8,["modelValue","fieldError"]),a(h,{isBusy:s(t).isBusy,caption:"auth.forms.change_password"},null,8,["isBusy"])],8,O)],40,G),n("form",{id:"frmDeleteAccount",onSubmit:b($,["prevent"]),onKeydown:e[9]||(e[9]=o=>s(m).onKeydown(o))},[n("h4",X,u(r.$t("auth.forms.delete_account")),1),n("div",Y,[n("p",Z,u(r.$t("auth.forms.delete_your_account_and_reset_all_data")),1),n("p",null,u(r.$t("auth.forms.reset_your_password_to_delete_your_account")),1),n("p",null,u(r.$t("auth.forms.deleting_2fauth_account_does_not_impact_provider")),1)]),n("fieldset",{disabled:s(c).config.proxyAuth},[a(f,{modelValue:s(m).password,"onUpdate:modelValue":e[8]||(e[8]=o=>s(m).password=o),fieldName:"password",fieldError:s(m).errors.get("password"),inputType:"password",autocomplete:"new-password",label:"auth.forms.current_password.label",help:"auth.forms.current_password.help"},null,8,["modelValue","fieldError"]),a(h,{isBusy:s(m).isBusy,caption:"auth.forms.delete_your_account",submitId:"btnDeleteAccount",color:"is-danger"},null,8,["isBusy"])],8,ee)],40,Q)]),_:1})]),a(k,{showButtons:!0},{default:E(()=>[a(S,{returnTo:{name:s(x)},action:"close"},null,8,["returnTo"])]),_:1})])}}};export{ae as default};
|