UNPKG

@eotl/core

Version:

Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.

88 lines (87 loc) 3.23 kB
import { ssrIdentity } from "@eotl/simple-signed-records"; import { useEotlCore } from "./store.js"; import { u as useAuthSsr } from "./authSsr-BedulHkH.js"; import { openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, toDisplayString, createCommentVNode } from "vue"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js"; const _sfc_main = { name: "AccountRestore", data() { const store = useEotlCore(); const authSsr = useAuthSsr(); return { store, authSsr, restoreSeed: "" }; }, methods: { btnRestoreAccount() { let words = this.restoreSeed.split(","); if (words.length !== 16) return; let { restoredSecretKey: secretKey, restoredPublicKey: publicKey } = ssrIdentity.restoreIdentity(words); this.authSsr.dispatch("restoreIdentity", { words, secretKey, publicKey }); let status = "active"; let cert = ssrIdentity.generateCert({ secretKey, publicKey }); this.authSsr.dispatch("restoreAccount", { status, cert }); this.$router.push({ path: "home" }); }, btnRestoreCancel() { let status = "new"; this.authSsr.dispatch("restoreAccount", { status }); } } }; const _hoisted_1 = { key: 0, class: "form-row my-3" }; const _hoisted_2 = { class: "col-md-8" }; const _hoisted_3 = ["placeholder"]; const _hoisted_4 = { class: "col-md-4" }; const _hoisted_5 = { key: 1 }; const _hoisted_6 = /* @__PURE__ */ createElementVNode("h4", null, "Restored", -1); const _hoisted_7 = /* @__PURE__ */ createElementVNode("p", null, "Your account was restored successfully", -1); const _hoisted_8 = [ _hoisted_6, _hoisted_7 ]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", null, [ $data.authSsr.account.status == "restore" ? (openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ withDirectives(createElementVNode("textarea", { class: "form-control", placeholder: _ctx.$t("auth.placeholderKey"), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.restoreSeed = $event) }, null, 8, _hoisted_3), [ [vModelText, $data.restoreSeed] ]) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("button", { class: "btn btn-block btn-success", onClick: _cache[1] || (_cache[1] = ($event) => $options.btnRestoreAccount()) }, toDisplayString(_ctx.$t("auth.btnRestoreKey")), 1), createElementVNode("button", { class: "btn btn-block btn-secondary", onClick: _cache[2] || (_cache[2] = ($event) => $options.btnRestoreCancel()) }, toDisplayString(_ctx.$t("auth.btnRestoreCancel")), 1) ]) ])) : $data.authSsr.account.status == "restored" ? (openBlock(), createElementBlock("div", _hoisted_5, _hoisted_8)) : createCommentVNode("", true) ]); } const AccountRestore = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { AccountRestore as A }; //# sourceMappingURL=AccountRestore-D7BfWASB.js.map