@eotl/core
Version:
Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.
87 lines (86 loc) • 3.33 kB
JavaScript
;
const simpleSignedRecords = require("@eotl/simple-signed-records");
const store = require("./store.cjs");
const authSsr = require("./authSsr-Aa_pi4mF.cjs");
const vue = require("vue");
const _pluginVue_exportHelper = require("./_plugin-vue_export-helper-DM9IkUGy.cjs");
const _sfc_main = {
name: "AccountRestore",
data() {
const store$1 = store.useEotlCore();
const authSsr$1 = authSsr.useAuthSsr();
return {
store: store$1,
authSsr: authSsr$1,
restoreSeed: ""
};
},
methods: {
btnRestoreAccount() {
let words = this.restoreSeed.split(",");
if (words.length !== 16) return;
let {
restoredSecretKey: secretKey,
restoredPublicKey: publicKey
} = simpleSignedRecords.ssrIdentity.restoreIdentity(words);
this.authSsr.dispatch("restoreIdentity", {
words,
secretKey,
publicKey
});
let status = "active";
let cert = simpleSignedRecords.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__ */ vue.createElementVNode("h4", null, "Restored", -1);
const _hoisted_7 = /* @__PURE__ */ vue.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 vue.openBlock(), vue.createElementBlock("div", null, [
$data.authSsr.account.status == "restore" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createElementVNode("div", _hoisted_2, [
vue.withDirectives(vue.createElementVNode("textarea", {
class: "form-control",
placeholder: _ctx.$t("auth.placeholderKey"),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.restoreSeed = $event)
}, null, 8, _hoisted_3), [
[vue.vModelText, $data.restoreSeed]
])
]),
vue.createElementVNode("div", _hoisted_4, [
vue.createElementVNode("button", {
class: "btn btn-block btn-success",
onClick: _cache[1] || (_cache[1] = ($event) => $options.btnRestoreAccount())
}, vue.toDisplayString(_ctx.$t("auth.btnRestoreKey")), 1),
vue.createElementVNode("button", {
class: "btn btn-block btn-secondary",
onClick: _cache[2] || (_cache[2] = ($event) => $options.btnRestoreCancel())
}, vue.toDisplayString(_ctx.$t("auth.btnRestoreCancel")), 1)
])
])) : $data.authSsr.account.status == "restored" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, _hoisted_8)) : vue.createCommentVNode("", true)
]);
}
const AccountRestore = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
exports.AccountRestore = AccountRestore;
//# sourceMappingURL=AccountRestore-DDasrBaI.cjs.map