5/5/1404
This commit is contained in:
@@ -0,0 +1,303 @@
|
||||
import { defineComponent, ref, reactive, mergeProps, unref, withCtx, createVNode, createTextVNode, toDisplayString, useSSRContext } from 'vue';
|
||||
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderSlot } from 'vue/server-renderer';
|
||||
import { B as BasicIconOld } from './BasicIconOld-I4c2ShMu.mjs';
|
||||
import { u as useRouter$1, a as useConfigStore, f as loading, h as generateOtp, e as api$1, v as verifyOtp, d as setToken, s as supabase, i as forgetPassword, r as removeToken } from './server.mjs';
|
||||
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
||||
import { _ as _sfc_main$4 } from './BasicInput-BEP6ZgUl.mjs';
|
||||
import { _ as _sfc_main$5 } from './BasicButton-BAlnoE_w.mjs';
|
||||
import OtpInput from 'vue3-otp-input';
|
||||
import { i as inputRulesNoMessage } from './inputRules-BErREp_b.mjs';
|
||||
import { _ as _sfc_main$3 } from './InstaInput-DqKUdtw2.mjs';
|
||||
import '../_/nitro.mjs';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:url';
|
||||
import 'consola';
|
||||
import 'ipx';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'pinia';
|
||||
import '@supabase/supabase-js';
|
||||
import '@babel/runtime/helpers/esm/extends';
|
||||
import '@babel/runtime/helpers/esm/objectSpread2';
|
||||
import '@ant-design/colors';
|
||||
import '@ctrl/tinycolor';
|
||||
import 'stylis';
|
||||
import 'vue-types';
|
||||
import 'lodash-es';
|
||||
import 'axios';
|
||||
import '@ant-design/icons-vue';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'unhead/server';
|
||||
import 'devalue';
|
||||
import 'unhead/utils';
|
||||
import 'unhead/plugins';
|
||||
import './usePrice-B-5-jXKQ.mjs';
|
||||
import './index--Q-kfs0Q.mjs';
|
||||
import './FormItemContext-CDDW52IT.mjs';
|
||||
import './statusUtils-C3ZNzkeD.mjs';
|
||||
import './BaseInput-_gwhwanN.mjs';
|
||||
import 'resize-observer-polyfill';
|
||||
import './index-C1mihc8c.mjs';
|
||||
import '../_/SearchOutlined.mjs';
|
||||
import 'lodash-es/isPlainObject.js';
|
||||
import './raf-ruCY1ktO.mjs';
|
||||
import './index-DqCYDGJX.mjs';
|
||||
import 'throttle-debounce';
|
||||
import './FormItem-DY7uTw8_.mjs';
|
||||
import 'lodash-es/cloneDeep.js';
|
||||
import 'async-validator';
|
||||
import 'lodash-es/find.js';
|
||||
import './index-Dxyzjwb5.mjs';
|
||||
import 'dom-align';
|
||||
import './collapseMotion-cQ2SGjCA.mjs';
|
||||
|
||||
const _sfc_main$2 = {};
|
||||
function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "border-2 border-solid rounded-xl px-2 pt-2 mt-2 inputUser" }, _attrs))}>`);
|
||||
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
|
||||
_push(`</div>`);
|
||||
}
|
||||
const _sfc_setup$2 = _sfc_main$2.setup;
|
||||
_sfc_main$2.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/InstaUserInput.vue");
|
||||
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
||||
};
|
||||
const InstaUserInput = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender]]);
|
||||
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
||||
__name: "index",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
const router = useRouter$1();
|
||||
const config = useConfigStore();
|
||||
ref(false);
|
||||
const step = ref("mobile");
|
||||
const form = reactive({
|
||||
mobile: void 0,
|
||||
otp: void 0,
|
||||
password: void 0
|
||||
});
|
||||
async function handleOnComplete(value) {
|
||||
form.otp = value;
|
||||
}
|
||||
async function updatePassword() {
|
||||
if (form.password.length < 6) {
|
||||
api$1.error(config.useString("minPassIs6"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
loading.value = true;
|
||||
const res = await forgetPassword(form.mobile, form.otp, form.password);
|
||||
removeToken();
|
||||
console.log("res ===>", res);
|
||||
router.push({ name: "auth-login" });
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
async function verifyCode() {
|
||||
try {
|
||||
loading.value = true;
|
||||
const res = await verifyOtp(form.mobile, form.otp);
|
||||
console.log("res ===>", res);
|
||||
setToken(res.session.access_token);
|
||||
await supabase.auth.setSession(res.session);
|
||||
step.value = "password";
|
||||
} catch (e) {
|
||||
console.log("e ===>", e);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
async function findAccount() {
|
||||
var _a;
|
||||
try {
|
||||
loading.value = true;
|
||||
const res = await generateOtp(form.mobile, "forget");
|
||||
if (!((_a = res == null ? void 0 : res.user) == null ? void 0 : _a.id)) {
|
||||
api$1.error(config.useString("userNotHaveAccount"));
|
||||
router.push({ name: "auth-login" });
|
||||
return;
|
||||
}
|
||||
step.value = "otp";
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "p3" }, _attrs))}><div class="flex items-center justify-left">`);
|
||||
_push(ssrRenderComponent(BasicIconOld, {
|
||||
icon: "vuesax-linear:arrow-left-1",
|
||||
class: "mb-5 font-semibold cursor-pointer",
|
||||
size: "26",
|
||||
onClick: ($event) => unref(router).back()
|
||||
}, null, _parent));
|
||||
_push(`</div><div class="p2">`);
|
||||
if (step.value === "mobile") {
|
||||
_push(`<div><div class="text-2xl font-bold">${ssrInterpolate(unref(config).useString("findYourAccount"))}</div><div class="mt3">${ssrInterpolate(unref(config).useString("enterYourPhone"))}</div>`);
|
||||
_push(ssrRenderComponent(_sfc_main$3, {
|
||||
class: "mt5",
|
||||
rules: unref(inputRulesNoMessage)(),
|
||||
value: form.mobile,
|
||||
"onUpdate:value": ($event) => form.mobile = $event,
|
||||
label: "phone",
|
||||
name: "mobile"
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(ssrRenderComponent(_sfc_main$4, {
|
||||
value: form.mobile,
|
||||
"onUpdate:value": ($event) => form.mobile = $event,
|
||||
"place-holder": unref(config).useString("phone")
|
||||
}, null, _parent2, _scopeId));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_sfc_main$4, {
|
||||
value: form.mobile,
|
||||
"onUpdate:value": ($event) => form.mobile = $event,
|
||||
"place-holder": unref(config).useString("phone")
|
||||
}, null, 8, ["value", "onUpdate:value", "place-holder"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(ssrRenderComponent(_sfc_main$5, {
|
||||
block: "",
|
||||
class: "mt-5",
|
||||
type: "primary",
|
||||
onClick: findAccount,
|
||||
size: "large",
|
||||
loading: unref(loading),
|
||||
curve: ""
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(`${ssrInterpolate(unref(config).useString("findAccount"))}`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(toDisplayString(unref(config).useString("findAccount")), 1)
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(`</div>`);
|
||||
} else if (step.value === "otp") {
|
||||
_push(`<div><div class="text-2xl font-bold">${ssrInterpolate(unref(config).useString("registerOtp"))}</div><div class="mt3">${ssrInterpolate(unref(config).useString("registerOtpDescription", form.mobile))}</div>`);
|
||||
_push(ssrRenderComponent(unref(OtpInput), {
|
||||
style: { "direction": "ltr" },
|
||||
class: "mt-10 justify-center",
|
||||
ref: "otpInput",
|
||||
autocomplete: "one-time-code",
|
||||
"input-classes": "otp-input",
|
||||
separator: "",
|
||||
"num-inputs": 5,
|
||||
"should-auto-focus": true,
|
||||
"is-input-num": true,
|
||||
onOnComplete: handleOnComplete
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_sfc_main$5, {
|
||||
block: "",
|
||||
class: "mt-5",
|
||||
type: "primary",
|
||||
onClick: verifyCode,
|
||||
size: "large",
|
||||
loading: unref(loading)
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(`${ssrInterpolate(unref(config).useString("verifyCode"))}`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(toDisplayString(unref(config).useString("verifyCode")), 1)
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(`</div>`);
|
||||
} else if (step.value === "password") {
|
||||
_push(`<div><div class="text-2xl font-bold">${ssrInterpolate(unref(config).useString("createNewPassword"))}</div><div class="mt3">${ssrInterpolate(unref(config).useString("registerPasswordDescription"))}</div>`);
|
||||
_push(ssrRenderComponent(InstaUserInput, { class: "mt5" }, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(`<div class="text-gray-6"${_scopeId}>${ssrInterpolate(unref(config).useString("password"))}</div>`);
|
||||
_push2(ssrRenderComponent(_sfc_main$4, {
|
||||
value: form.password,
|
||||
"onUpdate:value": ($event) => form.password = $event,
|
||||
"is-password": "",
|
||||
size: "large"
|
||||
}, null, _parent2, _scopeId));
|
||||
} else {
|
||||
return [
|
||||
createVNode("div", { class: "text-gray-6" }, toDisplayString(unref(config).useString("password")), 1),
|
||||
createVNode(_sfc_main$4, {
|
||||
value: form.password,
|
||||
"onUpdate:value": ($event) => form.password = $event,
|
||||
"is-password": "",
|
||||
size: "large"
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(ssrRenderComponent(_sfc_main$5, {
|
||||
block: "",
|
||||
class: "mt-5",
|
||||
type: "primary",
|
||||
onClick: updatePassword,
|
||||
size: "large",
|
||||
loading: unref(loading)
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(`${ssrInterpolate(unref(config).useString("updatePassword"))}`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(toDisplayString(unref(config).useString("updatePassword")), 1)
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(`</div>`);
|
||||
} else {
|
||||
_push(`<!---->`);
|
||||
}
|
||||
_push(`</div></div>`);
|
||||
};
|
||||
}
|
||||
});
|
||||
const _sfc_setup$1 = _sfc_main$1.setup;
|
||||
_sfc_main$1.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/forget/index.vue");
|
||||
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
__name: "index",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
_push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent));
|
||||
};
|
||||
}
|
||||
});
|
||||
const _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/auth/forget/index.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
|
||||
export { _sfc_main as default };
|
||||
//# sourceMappingURL=index-DYDZbwpq.mjs.map
|
||||
Reference in New Issue
Block a user