2FAuth/public/build/assets/Create-BDDyzqYe.js

2 lines
2.0 KiB
JavaScript
Raw Normal View History

2024-11-09 15:37:19 +01:00
import{a as _,c as F,d as V,j as r,k as b,l as n,m as y,e as g,f as o,C as x,p as B,H as C}from"./app-BActpDYy.js";import{F as E}from"./Form-BYep5rsU.js";/*! 2FAuth version 5.4.0 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const k={__name:"Create",setup(N){const l=_(),m=B(),e=F(new E({name:"",email:"",password:"",password_confirmation:"",is_admin:!1}));async function i(d){e.password_confirmation=e.password,e.post("/api/v1/users").then(a=>{const t=a.data;l.success({text:C("admin.user_created")}),m.push({name:"admin.manageUser",params:{userId:t.info.id}})})}return(d,a)=>{const t=n("FormField"),u=n("FormPasswordField"),p=n("FormCheckbox"),f=n("FormButtons"),c=n("FormWrapper"),w=n("VueFooter");return y(),V("div",null,[r(c,{title:"admin.new_user"},{default:b(()=>[g("form",{onSubmit:x(i,["prevent"]),onKeydown:a[4]||(a[4]=s=>o(e).onKeydown(s))},[r(t,{modelValue:o(e).name,"onUpdate:modelValue":a[0]||(a[0]=s=>o(e).name=s),fieldName:"name",fieldError:o(e).errors.get("name"),inputType:"text",label:"auth.forms.name",maxLength:255,autofocus:""},null,8,["modelValue","fieldError"]),r(t,{modelValue:o(e).email,"onUpdate:modelValue":a[1]||(a[1]=s=>o(e).email=s),fieldName:"email",fieldError:o(e).errors.get("email"),inputType:"email",label:"auth.forms.email",maxLength:255},null,8,["modelValue","fieldError"]),r(u,{modelValue:o(e).password,"onUpdate:modelValue":a[2]||(a[2]=s=>o(e).password=s),fieldName:"password",fieldError:o(e).errors.get("password"),showRules:!0,label:"auth.forms.password",autocomplete:"new-password"},null,8,["modelValue","fieldError"]),r(p,{modelValue:o(e).is_admin,"onUpdate:modelValue":a[3]||(a[3]=s=>o(e).is_admin=s),fieldName:"is_admin",label:"admin.forms.is_admin.label",help:"admin.forms.is_admin.help"},null,8,["modelValue"]),r(f,{isBusy:o(e).isBusy,isDisabled:o(e).isDisabled,showCancelButton:!0,cancelLandingView:"admin.users",caption:"commons.create",submitId:"btnCreateUser"},null,8,["isBusy","isDisabled","cancelLandingView"])],32)]),_:1}),r(w)])}}};export{k as default};