n8n-editor-ui
Version:
Workflow Editor UI for n8n
115 lines (114 loc) • 3.55 kB
JavaScript
import { It as ref, P as defineComponent, Pt as reactive, T as createBlock, et as openBlock } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
import { gt as useI18n } from "./_MapCache-B159LOu5.js";
import "./src-BW7zuOU1.js";
import "./en-b3uD8cvU.js";
import "./preload-helper-CR0ecmWK.js";
import "./_plugin-vue_export-helper-BwBpWJRZ.js";
import { y as useRouter } from "./truncate-Dc5upPom.js";
import "./icon-MZ_3fB_h.js";
import "./empty-4-N75rxI.js";
import { Ho as useSettingsStore, nr as useUsersStore } from "./useTelemetry-C797TaYa.js";
import { t as useToast } from "./useToast-ZaUhbG9w.js";
import "./sanitize-html-CgpOSgtK.js";
import "./CalendarDate-DxkU3CHY.js";
import "./path-browserify-B5h_dP_u.js";
import { Io as VIEWS } from "./constants-CX1ozgFz.js";
import "./merge-BArJwbQo.js";
import "./_baseOrderBy-DL6Sy5xK.js";
import "./dateformat-CMLc6OKJ.js";
import "./useDebounce-RgPaX171.js";
import "./useExternalHooks-CYMS6JpD.js";
import "./useStyles-DhM0cpS7.js";
import "./sso.store-B_c2j1dV.js";
import { t as AuthView_default } from "./AuthView-DDyHoJhx.js";
var SetupView_default = /* @__PURE__ */ defineComponent({
__name: "SetupView",
setup(__props) {
const settingsStore = useSettingsStore();
const usersStore = useUsersStore();
const toast = useToast();
const locale = useI18n();
const router = useRouter();
const loading = ref(false);
const formConfig = reactive({
title: locale.baseText("auth.setup.setupOwner"),
buttonText: locale.baseText("auth.setup.next"),
inputs: [
{
name: "email",
properties: {
label: locale.baseText("auth.email"),
type: "email",
required: true,
validationRules: [{ name: "VALID_EMAIL" }],
autocomplete: "email",
capitalize: true
}
},
{
name: "firstName",
properties: {
label: locale.baseText("auth.firstName"),
maxlength: 32,
required: true,
autocomplete: "given-name",
capitalize: true
}
},
{
name: "lastName",
properties: {
label: locale.baseText("auth.lastName"),
maxlength: 32,
required: true,
autocomplete: "family-name",
capitalize: true
}
},
{
name: "password",
properties: {
label: locale.baseText("auth.password"),
type: "password",
required: true,
validationRules: [{ name: "DEFAULT_PASSWORD_RULES" }],
infoText: locale.baseText("auth.defaultPasswordRequirements"),
autocomplete: "new-password",
capitalize: true
}
},
{
name: "agree",
properties: {
label: locale.baseText("auth.agreement.label"),
type: "checkbox"
}
}
]
});
const onSubmit = async (values) => {
try {
const forceRedirectedHere = settingsStore.showSetupPage;
loading.value = true;
await usersStore.createOwner(values);
if (values.agree === true) try {
await usersStore.submitContactEmail(values.email.toString(), values.agree);
} catch {}
if (forceRedirectedHere) await router.push({ name: VIEWS.HOMEPAGE });
else await router.push({ name: VIEWS.USERS_SETTINGS });
} catch (error) {
toast.showError(error, locale.baseText("auth.setup.settingUpOwnerError"));
}
loading.value = false;
};
return (_ctx, _cache) => {
return openBlock(), createBlock(AuthView_default, {
form: formConfig,
"form-loading": loading.value,
"data-test-id": "setup-form",
onSubmit
}, null, 8, ["form", "form-loading"]);
};
}
});
export { SetupView_default as default };