@ozdao/prometheus-framework 0.1.79 → 0.1.81
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +15 -17
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +24 -26
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +28 -30
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +78 -79
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +30 -32
- package/dist/prometheus-framework/src/modules/auth/localization/EnterCode.json.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/localization/EnterCode.json.js +20 -0
- package/dist/prometheus-framework/src/modules/auth/localization/EnterPassword.json.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/localization/EnterPassword.json.js +26 -0
- package/dist/prometheus-framework/src/modules/auth/localization/ResetPassword.json.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/localization/ResetPassword.json.js +30 -0
- package/dist/prometheus-framework/src/modules/auth/localization/SignIn.json.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/localization/SignIn.json.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/localization/SignUp.json.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/localization/SignUp.json.js +32 -0
- package/dist/prometheus-framework/src/modules/auth/router/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/router/auth.js +114 -111
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/modules/auth/components/pages/EnterCode.vue +4 -4
- package/src/modules/auth/components/pages/EnterPassword.vue +3 -4
- package/src/modules/auth/components/pages/ResetPassword.vue +4 -5
- package/src/modules/auth/components/pages/SignIn.vue +12 -10
- package/src/modules/auth/components/pages/SignUp.vue +4 -5
- package/src/modules/auth/localization/EnterCode.json +13 -11
- package/src/modules/auth/localization/EnterPassword.json +19 -17
- package/src/modules/auth/localization/ResetPassword.json +23 -21
- package/src/modules/auth/localization/SignIn.json +1 -1
- package/src/modules/auth/localization/SignUp.json +25 -23
- package/src/modules/auth/router/auth.js +95 -86
- package/src/modules/middlewares/client/inputs.validation.js +1 -0
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue");require("../../../../components/Field/Field.vue.cjs");const
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue");require("../../../../components/Field/Field.vue.cjs");const f=require("vue-router"),S=require("vue-i18n"),c=require("../../store/auth.cjs"),g=require("../../store/twofa.cjs"),y=require("../../../globals/store/globals.cjs"),b=require("../../localization/EnterCode.json.cjs"),D={class:"t-center pd-medium"},I={class:"mn-medium"},q={class:"mn-big t-transp"},k={class:"w-100 mn-big flex-nowrap flex"},C={key:1},N={__name:"EnterCode",setup(P){const m=f.useRoute(),v=f.useRouter(),{t:d}=S.useI18n(b.default),o=n.reactive({digits:["","","",""],error:null});n.watch(()=>o.digits[0],s=>{if(console.log(String(s)),console.log(String(s).length),s&&String(s).length>1){let e=String(s).split("");console.log(e);let t=[...o.digits];e.forEach((l,r)=>{console.log(r),console.log(t[r]),console.log(l),t[r]=l}),o.digits=t,u(3)}});const p=n.ref(null),i=n.ref(0);async function E(){try{await g.sendCode(c.state.user,m.query.type,c.state.user.phone?"phone":"email"),i.value=30;const s=setInterval(()=>{i.value>0?i.value-=1:clearInterval(s)},1e3)}catch{y.setError({response:{data:{errorCode:"CODE_NOT_SENT"}}})}}const a=(s,e)=>{if(s.key==="Backspace"&&(o.digits[e]===null||o.digits[e]===void 0||o.digits[e]==="")){s.preventDefault();const t=document.querySelectorAll("input"),l=e>0?t[e-1]:null;l&&(l.focus(),l.setSelectionRange(l.value.length,l.value.length))}},u=s=>{const e=document.querySelectorAll("input"),t=e[s+1],l=s>0?e[s-1]:null;if(o.digits[s]!==""&&o.digits[s]!==null&&o.digits[s]!==void 0&&s<4&&(s<3?t.focus():p.value.focus()),(o.digits[s]===null||o.digits[s]===void 0||o.digits[s]==="")&&s>0&&l.focus(),o.digits.every(r=>r!=="")){const r=o.digits.join(""),w=g.state.code.code.toString();r===w?(g.state.code.isValid=!0,v.push({path:"/auth/enter-password",query:{type:g.state.code.type,method:m.query.method}})):(y.setError({response:{data:{errorCode:"WRONG_CODE"}}}),p.value.focus(),o.digits=["","","",""])}};return(s,e)=>(n.openBlock(),n.createElementBlock("section",D,[n.createElementVNode("h3",I,n.toDisplayString(n.unref(d)("verifyNumberTitle")),1),n.createElementVNode("p",q,n.toDisplayString(n.unref(d)("instructions")),1),n.createElementVNode("div",k,[n.withDirectives(n.createElementVNode("input",{type:"number","onUpdate:modelValue":e[0]||(e[0]=t=>o.digits[0]=t),ref_key:"firstInput",ref:p,maxlength:"1",onInput:e[1]||(e[1]=t=>u(0)),onPaste:e[2]||(e[2]=t=>s.onPaste(t,0)),onKeydown:e[3]||(e[3]=t=>a(t,0)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[n.vModelText,o.digits[0]]]),n.withDirectives(n.createElementVNode("input",{type:"number","onUpdate:modelValue":e[4]||(e[4]=t=>o.digits[1]=t),maxlength:"1",onInput:e[5]||(e[5]=t=>u(1)),onPaste:e[6]||(e[6]=t=>s.onPaste(t,1)),onKeydown:e[7]||(e[7]=t=>a(t,1)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[n.vModelText,o.digits[1]]]),n.withDirectives(n.createElementVNode("input",{type:"number","onUpdate:modelValue":e[8]||(e[8]=t=>o.digits[2]=t),maxlength:"1",onInput:e[9]||(e[9]=t=>u(2)),onPaste:e[10]||(e[10]=t=>s.onPaste(t,2)),onKeydown:e[11]||(e[11]=t=>a(t,2)),class:"w-100 h1 pd-small t-center bg-grey radius-small mn-r-small"},null,544),[[n.vModelText,o.digits[2]]]),n.withDirectives(n.createElementVNode("input",{type:"number","onUpdate:modelValue":e[12]||(e[12]=t=>o.digits[3]=t),maxlength:"1",onInput:e[13]||(e[13]=t=>u(3)),onPaste:e[14]||(e[14]=t=>s.onPaste(t,3)),onKeydown:e[15]||(e[15]=t=>a(t,3)),class:"w-100 h1 pd-small t-center bg-grey radius-small"},null,544),[[n.vModelText,o.digits[3]]])]),i.value<1?(n.openBlock(),n.createElementBlock("a",{key:0,onClick:E,class:"t-blue"},n.toDisplayString(n.unref(d)("resendCode")),1)):(n.openBlock(),n.createElementBlock("span",C,n.toDisplayString(i.value)+" "+n.toDisplayString(n.unref(d)("secondsResend")),1))]))}};exports.default=N;
|
@@ -2,16 +2,14 @@ import { reactive as D, watch as $, ref as b, openBlock as v, createElementBlock
|
|
2
2
|
import "../../../../components/Field/Field.vue.js";
|
3
3
|
import { useRoute as q, useRouter as K } from "vue-router";
|
4
4
|
import { useI18n as N } from "vue-i18n";
|
5
|
-
import { state as
|
5
|
+
import { state as C } from "../../store/auth.js";
|
6
6
|
import { state as w, sendCode as R } from "../../store/twofa.js";
|
7
|
-
import { setError as
|
8
|
-
|
7
|
+
import { setError as S } from "../../../globals/store/globals.js";
|
8
|
+
import T from "../../localization/EnterCode.json.js";
|
9
|
+
const A = { class: "t-center pd-medium" }, O = { class: "mn-medium" }, U = { class: "mn-big t-transp" }, B = { class: "w-100 mn-big flex-nowrap flex" }, V = { key: 1 }, Q = {
|
9
10
|
__name: "EnterCode",
|
10
|
-
setup(
|
11
|
-
const I = q(), k = K(), { t: p } = N({
|
12
|
-
inheritLocale: !0,
|
13
|
-
useScope: "local"
|
14
|
-
}), n = D({
|
11
|
+
setup(j) {
|
12
|
+
const I = q(), k = K(), { t: p } = N(T), n = D({
|
15
13
|
digits: ["", "", "", ""],
|
16
14
|
error: null
|
17
15
|
});
|
@@ -31,12 +29,12 @@ const T = { class: "t-center pd-medium" }, A = { class: "mn-medium" }, O = { cla
|
|
31
29
|
const y = b(null), i = b(0);
|
32
30
|
async function E() {
|
33
31
|
try {
|
34
|
-
await R(
|
32
|
+
await R(C.user, I.query.type, C.user.phone ? "phone" : "email"), i.value = 30;
|
35
33
|
const s = setInterval(() => {
|
36
34
|
i.value > 0 ? i.value -= 1 : clearInterval(s);
|
37
35
|
}, 1e3);
|
38
36
|
} catch {
|
39
|
-
|
37
|
+
S({ response: { data: { errorCode: "CODE_NOT_SENT" } } });
|
40
38
|
}
|
41
39
|
}
|
42
40
|
const a = (s, t) => {
|
@@ -52,13 +50,13 @@ const T = { class: "t-center pd-medium" }, A = { class: "mn-medium" }, O = { cla
|
|
52
50
|
l === P ? (w.code.isValid = !0, k.push({
|
53
51
|
path: "/auth/enter-password",
|
54
52
|
query: { type: w.code.type, method: I.query.method }
|
55
|
-
})) : (
|
53
|
+
})) : (S({ response: { data: { errorCode: "WRONG_CODE" } } }), y.value.focus(), n.digits = ["", "", "", ""]);
|
56
54
|
}
|
57
55
|
};
|
58
|
-
return (s, t) => (v(), c("section",
|
59
|
-
r("h3",
|
60
|
-
r("p",
|
61
|
-
r("div",
|
56
|
+
return (s, t) => (v(), c("section", A, [
|
57
|
+
r("h3", O, d(m(p)("verifyNumberTitle")), 1),
|
58
|
+
r("p", U, d(m(p)("instructions")), 1),
|
59
|
+
r("div", B, [
|
62
60
|
g(r("input", {
|
63
61
|
type: "number",
|
64
62
|
"onUpdate:modelValue": t[0] || (t[0] = (e) => n.digits[0] = e),
|
@@ -110,10 +108,10 @@ const T = { class: "t-center pd-medium" }, A = { class: "mn-medium" }, O = { cla
|
|
110
108
|
key: 0,
|
111
109
|
onClick: E,
|
112
110
|
class: "t-blue"
|
113
|
-
}, d(m(p)("resendCode")), 1)) : (v(), c("span",
|
111
|
+
}, d(m(p)("resendCode")), 1)) : (v(), c("span", V, d(i.value) + " " + d(m(p)("secondsResend")), 1))
|
114
112
|
]));
|
115
113
|
}
|
116
114
|
};
|
117
115
|
export {
|
118
|
-
|
116
|
+
Q as default
|
119
117
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../../../components/Tab/Tab.vue.cjs");const l=require("../../../../components/Field/Field.vue2.cjs"),f=require("../../../../components/Button/Button.vue2.cjs"),
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../../../components/Tab/Tab.vue.cjs");const l=require("../../../../components/Field/Field.vue2.cjs"),f=require("../../../../components/Button/Button.vue2.cjs"),d=require("vue-router"),h=require("vue-i18n"),t=require("../../store/auth.cjs"),i=require("../../../middlewares/client/inputs.validation.cjs"),w=require("../../localization/EnterPassword.json.cjs");require("./EnterPassword.vue2.cjs");const y={class:"t-left pd-medium"},_={class:"mn-small"},g={key:0,class:"mn-semi t-transp"},k={key:1,class:"mn-semi t-transp"},q={class:"mn-semi radius-small o-hidden"},B={key:2,class:"p-medium t-semi mn-semi"},E=e.createElementVNode("a",{class:"t-second",href:"https://thecommunephuket.com/legal/eula",target:"_blank",rel:"noopener noreferrer"},"End User License Agreement (EULA)",-1),P={key:0},v={key:1},b={__name:"EnterPassword",setup(V){const n=e.ref(null),{t:s}=h.useI18n(w.default),r=d.useRoute(),u=d.useRouter();e.ref("phone");async function c(){try{await i.validateInputs(n,i.validatePassword,t.state.user.password,"Некорректный пароль")}catch{throw new Error}r.query.method==="reset-password"&&await t.actions.updatePassword(t.state.user,r.query.type),r.query.method!=="reset-password"&&await t.actions.signup(t.state.user,r.query.type)}function p(){u.push({name:"User Profile",params:{_id:t.state.user._id},query:{afterAuth:"true"}})}return(m,o)=>(e.openBlock(),e.createElementBlock("section",y,[e.createElementVNode("h3",_,e.toDisplayString(e.unref(s)("almostDone")),1),e.unref(r).query.method==="reset-password"?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(e.unref(s)("newPasswordPrompt")),1)):(e.openBlock(),e.createElementBlock("p",k,e.toDisplayString(e.unref(s)("registrationPasswordPrompt")),1)),e.createElementVNode("div",q,[e.createVNode(l.default,{field:t.state.user.password,"onUpdate:field":o[0]||(o[0]=a=>t.state.user.password=a),type:"password",validation:n.value,placeholder:e.unref(s)("passwordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","validation","placeholder"]),e.createVNode(l.default,{field:t.state.user.passwordRepeat,"onUpdate:field":o[1]||(o[1]=a=>t.state.user.passwordRepeat=a),type:"password",placeholder:e.unref(s)("repeatPasswordPlaceholder"),class:"bg-grey pd-small radius-small mn-thin"},null,8,["field","placeholder"])]),e.unref(r).query.method!=="reset-password"?(e.openBlock(),e.createElementBlock("div",B,[e.createTextVNode(" By registering, you agree to our "),E])):e.createCommentVNode("",!0),e.createVNode(f.default,{submit:c,callback:p,class:"mn-big"},{default:e.withCtx(()=>[e.unref(r).query.method==="reset-password"?(e.openBlock(),e.createElementBlock("span",P,e.toDisplayString(e.unref(s)("changePasswordBtn")),1)):(e.openBlock(),e.createElementBlock("span",v,e.toDisplayString(e.unref(s)("registerBtn")),1))]),_:1})]))}};exports.default=b;
|
@@ -1,39 +1,37 @@
|
|
1
|
-
import { ref as u, openBlock as o, createElementBlock as a, createElementVNode as
|
1
|
+
import { ref as u, openBlock as o, createElementBlock as a, createElementVNode as m, toDisplayString as d, unref as e, createVNode as l, createTextVNode as g, createCommentVNode as P, withCtx as k } from "vue";
|
2
2
|
import "../../../../components/Tab/Tab.vue.js";
|
3
3
|
import c from "../../../../components/Field/Field.vue2.js";
|
4
4
|
import q from "../../../../components/Button/Button.vue2.js";
|
5
5
|
import { useRoute as b, useRouter as v } from "vue-router";
|
6
6
|
import { useI18n as E } from "vue-i18n";
|
7
7
|
import { state as s, actions as h } from "../../store/auth.js";
|
8
|
-
import { validateInputs as
|
8
|
+
import { validateInputs as x, validatePassword as B } from "../../../middlewares/client/inputs.validation.js";
|
9
|
+
import U from "../../localization/EnterPassword.json.js";
|
9
10
|
import "./EnterPassword.vue2.js";
|
10
|
-
const V = { class: "t-left pd-medium" },
|
11
|
+
const V = { class: "t-left pd-medium" }, N = { class: "mn-small" }, R = {
|
11
12
|
key: 0,
|
12
13
|
class: "mn-semi t-transp"
|
13
|
-
},
|
14
|
+
}, A = {
|
14
15
|
key: 1,
|
15
16
|
class: "mn-semi t-transp"
|
16
|
-
},
|
17
|
+
}, C = { class: "mn-semi radius-small o-hidden" }, D = {
|
17
18
|
key: 2,
|
18
19
|
class: "p-medium t-semi mn-semi"
|
19
|
-
},
|
20
|
+
}, I = /* @__PURE__ */ m("a", {
|
20
21
|
class: "t-second",
|
21
22
|
href: "https://thecommunephuket.com/legal/eula",
|
22
23
|
target: "_blank",
|
23
24
|
rel: "noopener noreferrer"
|
24
|
-
}, "End User License Agreement (EULA)", -1),
|
25
|
+
}, "End User License Agreement (EULA)", -1), L = { key: 0 }, S = { key: 1 }, Q = {
|
25
26
|
__name: "EnterPassword",
|
26
|
-
setup(
|
27
|
-
const
|
28
|
-
inheritLocale: !0,
|
29
|
-
useScope: "local"
|
30
|
-
}), r = b(), f = v();
|
27
|
+
setup(T) {
|
28
|
+
const p = u(null), { t } = E(U), r = b(), f = v();
|
31
29
|
u("phone");
|
32
30
|
async function w() {
|
33
31
|
try {
|
34
|
-
await
|
35
|
-
|
36
|
-
|
32
|
+
await x(
|
33
|
+
p,
|
34
|
+
B,
|
37
35
|
s.user.password,
|
38
36
|
"Некорректный пароль"
|
39
37
|
);
|
@@ -51,29 +49,29 @@ const V = { class: "t-left pd-medium" }, x = { class: "mn-small" }, N = {
|
|
51
49
|
query: { afterAuth: "true" }
|
52
50
|
});
|
53
51
|
}
|
54
|
-
return (y,
|
55
|
-
|
56
|
-
e(r).query.method === "reset-password" ? (o(), a("p",
|
57
|
-
|
52
|
+
return (y, n) => (o(), a("section", V, [
|
53
|
+
m("h3", N, d(e(t)("almostDone")), 1),
|
54
|
+
e(r).query.method === "reset-password" ? (o(), a("p", R, d(e(t)("newPasswordPrompt")), 1)) : (o(), a("p", A, d(e(t)("registrationPasswordPrompt")), 1)),
|
55
|
+
m("div", C, [
|
58
56
|
l(c, {
|
59
57
|
field: s.user.password,
|
60
|
-
"onUpdate:field":
|
58
|
+
"onUpdate:field": n[0] || (n[0] = (i) => s.user.password = i),
|
61
59
|
type: "password",
|
62
|
-
validation:
|
60
|
+
validation: p.value,
|
63
61
|
placeholder: e(t)("passwordPlaceholder"),
|
64
62
|
class: "bg-grey pd-small radius-small mn-thin"
|
65
63
|
}, null, 8, ["field", "validation", "placeholder"]),
|
66
64
|
l(c, {
|
67
65
|
field: s.user.passwordRepeat,
|
68
|
-
"onUpdate:field":
|
66
|
+
"onUpdate:field": n[1] || (n[1] = (i) => s.user.passwordRepeat = i),
|
69
67
|
type: "password",
|
70
68
|
placeholder: e(t)("repeatPasswordPlaceholder"),
|
71
69
|
class: "bg-grey pd-small radius-small mn-thin"
|
72
70
|
}, null, 8, ["field", "placeholder"])
|
73
71
|
]),
|
74
|
-
e(r).query.method !== "reset-password" ? (o(), a("div",
|
72
|
+
e(r).query.method !== "reset-password" ? (o(), a("div", D, [
|
75
73
|
g(" By registering, you agree to our "),
|
76
|
-
|
74
|
+
I
|
77
75
|
])) : P("", !0),
|
78
76
|
l(q, {
|
79
77
|
submit: w,
|
@@ -81,7 +79,7 @@ const V = { class: "t-left pd-medium" }, x = { class: "mn-small" }, N = {
|
|
81
79
|
class: "mn-big"
|
82
80
|
}, {
|
83
81
|
default: k(() => [
|
84
|
-
e(r).query.method === "reset-password" ? (o(), a("span",
|
82
|
+
e(r).query.method === "reset-password" ? (o(), a("span", L, d(e(t)("changePasswordBtn")), 1)) : (o(), a("span", S, d(e(t)("registerBtn")), 1))
|
85
83
|
]),
|
86
84
|
_: 1
|
87
85
|
})
|
@@ -89,5 +87,5 @@ const V = { class: "t-left pd-medium" }, x = { class: "mn-small" }, N = {
|
|
89
87
|
}
|
90
88
|
};
|
91
89
|
export {
|
92
|
-
|
90
|
+
Q as default
|
93
91
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("../../../../components/Tab/Tab.vue2.cjs"),f=require("../../../../components/Field/Field.vue2.cjs"),v=require("../../../../components/FieldPhone/FieldPhone.vue.cjs"),_=require("../../../../components/Button/Button.vue2.cjs"),
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("../../../../components/Tab/Tab.vue2.cjs"),f=require("../../../../components/Field/Field.vue2.cjs"),v=require("../../../../components/FieldPhone/FieldPhone.vue.cjs"),_=require("../../../../components/Button/Button.vue2.cjs"),u=require("vue-router"),w=require("vue-i18n"),V=require("../../localization/ResetPassword.json.cjs"),s=require("../../store/auth.cjs");require("../../store/twofa.cjs");const n=require("../../../middlewares/client/inputs.validation.cjs");require("./ResetPassword.vue2.cjs");const g={class:"t-left pd-medium"},y={class:"mn-small"},N={class:"mn-small t-transp"},b={class:"mn-small p-small uppercase t-semi bg-grey radius-big o-hidden"},q={class:"pos-relative"},E={key:0,class:"mn-semi radius-small o-hidden"},k={class:"mn-small t-transp"},C={key:0,class:"mn-semi radius-small o-hidden"},P={class:"mn-small t-transp"},S={__name:"ResetPassword",setup(I){const{t}=w.useI18n(V.default),i=e.ref(null),d=e.ref(null);u.useRoute();const c=u.useRouter(),a=e.ref("phone");async function m(){try{a.value==="phone"&&await n.validateInputs(i,n.validatePhone,s.state.user.phone,"Некорректный телефон"),a.value==="email"&&await n.validateInputs(d,n.validateEmail,s.state.user.email,"Некорректный email")}catch{throw new Error}try{await s.actions.resetPassword(s.state.user,a.value,"reset-password")}catch(r){throw console.log(r),new Error}}function p(){c.push({name:"Enter Code",query:{type:a.value,method:"reset-password"}})}return(r,o)=>(e.openBlock(),e.createElementBlock("section",g,[e.createElementVNode("h3",y,e.toDisplayString(e.unref(t)("forgotPasswordTitle")),1),e.createElementVNode("p",N,e.toDisplayString(e.unref(t)("instructions")),1),e.createElementVNode("div",b,[e.createVNode(h.default,{selected:a.value,"onUpdate:selected":o[0]||(o[0]=l=>a.value=l),tabs:[{name:e.unref(t)("phone"),value:"phone"},{name:e.unref(t)("email"),value:"email"}]},null,8,["selected","tabs"])]),e.createElementVNode("div",q,[e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[a.value==="phone"?(e.openBlock(),e.createElementBlock("div",E,[e.createElementVNode("p",k,e.toDisplayString(e.unref(t)("smsInfo")),1),e.createVNode(v.default,{modelValue:s.state.user.phone,"onUpdate:modelValue":o[1]||(o[1]=l=>s.state.user.phone=l),dropdownOptions:{showDialCodeInSelection:!0,showFlags:!0,showDialCodeInList:!0},validation:i.value,mode:"national",inputOptions:{placeholder:e.unref(t)("phonePlaceholder")},class:"bg-grey pd-small radius-small mn-thin"},null,8,["modelValue","validation","inputOptions"])])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[a.value==="email"?(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("p",P,e.toDisplayString(e.unref(t)("emailInfo")),1),e.createVNode(f.default,{field:s.state.user.email,"onUpdate:field":o[2]||(o[2]=l=>s.state.user.email=l),placeholder:e.unref(t)("emailPlaceholder"),validation:d.value,class:"bg-grey pd-medium radius-small"},null,8,["field","placeholder","validation"])])):e.createCommentVNode("",!0)]),_:1})]),e.createVNode(_.default,{submit:m,callback:p,class:"mn-big"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sendCode")),1)]),_:1})]))}};exports.default=S;
|
@@ -5,43 +5,41 @@ import E from "../../../../components/FieldPhone/FieldPhone.vue.js";
|
|
5
5
|
import I from "../../../../components/Button/Button.vue2.js";
|
6
6
|
import { useRoute as k, useRouter as x } from "vue-router";
|
7
7
|
import { useI18n as N } from "vue-i18n";
|
8
|
-
import
|
8
|
+
import T from "../../localization/ResetPassword.json.js";
|
9
|
+
import { state as s, actions as D } from "../../store/auth.js";
|
9
10
|
import "../../store/twofa.js";
|
10
|
-
import { validateInputs as w, validatePhone as
|
11
|
+
import { validateInputs as w, validatePhone as F, validateEmail as O } from "../../../middlewares/client/inputs.validation.js";
|
11
12
|
import "./ResetPassword.vue2.js";
|
12
|
-
const
|
13
|
+
const R = { class: "t-left pd-medium" }, S = { class: "mn-small" }, U = { class: "mn-small t-transp" }, B = { class: "mn-small p-small uppercase t-semi bg-grey radius-big o-hidden" }, $ = { class: "pos-relative" }, q = {
|
13
14
|
key: 0,
|
14
15
|
class: "mn-semi radius-small o-hidden"
|
15
|
-
},
|
16
|
+
}, A = { class: "mn-small t-transp" }, L = {
|
16
17
|
key: 0,
|
17
18
|
class: "mn-semi radius-small o-hidden"
|
18
|
-
},
|
19
|
+
}, j = { class: "mn-small t-transp" }, oe = {
|
19
20
|
__name: "ResetPassword",
|
20
|
-
setup(
|
21
|
-
const { t: e } = N(
|
22
|
-
inheritLocale: !0,
|
23
|
-
useScope: "local"
|
24
|
-
}), h = m(null), f = m(null);
|
21
|
+
setup(z) {
|
22
|
+
const { t: e } = N(T), h = m(null), f = m(null);
|
25
23
|
k();
|
26
24
|
const g = x(), o = m("phone");
|
27
25
|
async function b() {
|
28
26
|
try {
|
29
27
|
o.value === "phone" && await w(
|
30
28
|
h,
|
31
|
-
|
32
|
-
|
29
|
+
F,
|
30
|
+
s.user.phone,
|
33
31
|
"Некорректный телефон"
|
34
32
|
), o.value === "email" && await w(
|
35
33
|
f,
|
36
|
-
|
37
|
-
|
34
|
+
O,
|
35
|
+
s.user.email,
|
38
36
|
"Некорректный email"
|
39
37
|
);
|
40
38
|
} catch {
|
41
39
|
throw new Error();
|
42
40
|
}
|
43
41
|
try {
|
44
|
-
await
|
42
|
+
await D.resetPassword(s.user, o.value, "reset-password");
|
45
43
|
} catch (d) {
|
46
44
|
throw console.log(d), new Error();
|
47
45
|
}
|
@@ -49,27 +47,27 @@ const F = { class: "t-left pd-medium" }, O = { class: "mn-small" }, R = { class:
|
|
49
47
|
function y() {
|
50
48
|
g.push({ name: "Enter Code", query: { type: o.value, method: "reset-password" } });
|
51
49
|
}
|
52
|
-
return (d,
|
53
|
-
l("h3",
|
54
|
-
l("p",
|
55
|
-
l("div",
|
50
|
+
return (d, a) => (u(), p("section", R, [
|
51
|
+
l("h3", S, r(t(e)("forgotPasswordTitle")), 1),
|
52
|
+
l("p", U, r(t(e)("instructions")), 1),
|
53
|
+
l("div", B, [
|
56
54
|
i(P, {
|
57
55
|
selected: o.value,
|
58
|
-
"onUpdate:selected":
|
56
|
+
"onUpdate:selected": a[0] || (a[0] = (n) => o.value = n),
|
59
57
|
tabs: [
|
60
58
|
{ name: t(e)("phone"), value: "phone" },
|
61
59
|
{ name: t(e)("email"), value: "email" }
|
62
60
|
]
|
63
61
|
}, null, 8, ["selected", "tabs"])
|
64
62
|
]),
|
65
|
-
l("div",
|
63
|
+
l("div", $, [
|
66
64
|
i(_, { name: "slide-fade" }, {
|
67
65
|
default: c(() => [
|
68
|
-
o.value === "phone" ? (u(), p("div",
|
69
|
-
l("p",
|
66
|
+
o.value === "phone" ? (u(), p("div", q, [
|
67
|
+
l("p", A, r(t(e)("smsInfo")), 1),
|
70
68
|
i(E, {
|
71
|
-
modelValue:
|
72
|
-
"onUpdate:modelValue":
|
69
|
+
modelValue: s.user.phone,
|
70
|
+
"onUpdate:modelValue": a[1] || (a[1] = (n) => s.user.phone = n),
|
73
71
|
dropdownOptions: {
|
74
72
|
showDialCodeInSelection: !0,
|
75
73
|
showFlags: !0,
|
@@ -86,11 +84,11 @@ const F = { class: "t-left pd-medium" }, O = { class: "mn-small" }, R = { class:
|
|
86
84
|
}),
|
87
85
|
i(_, { name: "slide-fade" }, {
|
88
86
|
default: c(() => [
|
89
|
-
o.value === "email" ? (u(), p("div",
|
90
|
-
l("p",
|
87
|
+
o.value === "email" ? (u(), p("div", L, [
|
88
|
+
l("p", j, r(t(e)("emailInfo")), 1),
|
91
89
|
i(C, {
|
92
|
-
field:
|
93
|
-
"onUpdate:field":
|
90
|
+
field: s.user.email,
|
91
|
+
"onUpdate:field": a[2] || (a[2] = (n) => s.user.email = n),
|
94
92
|
placeholder: t(e)("emailPlaceholder"),
|
95
93
|
validation: f.value,
|
96
94
|
class: "bg-grey pd-medium radius-small"
|
@@ -114,5 +112,5 @@ const F = { class: "t-left pd-medium" }, O = { class: "mn-small" }, R = { class:
|
|
114
112
|
}
|
115
113
|
};
|
116
114
|
export {
|
117
|
-
|
115
|
+
oe as default
|
118
116
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("../../../../components/Tab/Tab.vue2.cjs"),c=require("../../../../components/Field/Field.vue2.cjs"),V=require("../../../../components/FieldPhone/FieldPhone.vue.cjs"),w=require("../../../../components/Button/Button.vue2.cjs"),p=require("vue-router"),N=require("vue-i18n"),b=require("../../localization/SignIn.json.cjs"),a=require("../../store/auth.cjs"),
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("../../../../components/Tab/Tab.vue2.cjs"),c=require("../../../../components/Field/Field.vue2.cjs"),V=require("../../../../components/FieldPhone/FieldPhone.vue.cjs"),w=require("../../../../components/Button/Button.vue2.cjs"),p=require("vue-router"),N=require("vue-i18n"),b=require("../../localization/SignIn.json.cjs"),a=require("../../store/auth.cjs"),r=require("../../../middlewares/client/inputs.validation.cjs");require("./SignIn.vue2.cjs");const y={class:""},S=["src"],E={class:"mn-medium"},q=e.createElementVNode("br",null,null,-1),x={class:"t-semi"},C={class:"mn-big"},D={class:"mn-small p-small uppercase t-semi bg-grey radius-big o-hidden"},P={class:"pos-relative"},T={class:"mn-thin radius-small"},I={class:"mn-thin radius-small o-hidden"},U={class:"w-100 mn-big"},k={__name:"SignIn",setup(j){const d=e.ref(null),m=e.ref(null),u=e.ref(null);p.useRoute();const h=p.useRouter(),{t:l}=N.useI18n(b.default),n=e.ref("phone"),f=o=>new Promise((s,i)=>{const t=document.createElement("script");t.type="text/javascript",t.src=o,t.onload=s,t.onerror=i,document.head.appendChild(t)});e.onMounted(async()=>{await f("https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js")});async function v(){try{n.value==="phone"&&await r.validateInputs(d,r.validatePhone,a.state.user.phone,"Некорректный телефон"),n.value==="email"&&await r.validateInputs(u,r.validateEmail,a.state.user.email,"Некорректный email")}catch{throw new Error}const o={...a.state.user};o.phone=a.state.user.phone.number,await a.actions.login(o,n.value)}function _(){h.push({name:"User Profile",params:{_id:a.state.user._id},query:{afterAuth:"true"}})}return(o,s)=>{const i=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("section",y,[e.createElementVNode("img",{src:"/logo/logo_square.svg",class:"i-extra radius-small mn-small"},null,8,S),e.createElementVNode("h3",E,[e.createTextVNode(e.toDisplayString(e.unref(l)("title"))+" ",1),q,e.createElementVNode("span",x,e.toDisplayString(e.unref(l)("subtitle")),1)]),e.createElementVNode("p",C,[e.createVNode(i,{to:{name:"Sign Up"},class:"underline t-second"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("signup")),1)]),_:1})]),e.createElementVNode("div",D,[e.createVNode(g.default,{selected:n.value,"onUpdate:selected":s[0]||(s[0]=t=>n.value=t),tabs:[{name:e.unref(l)("phone"),value:"phone"},{name:e.unref(l)("email"),value:"email"}]},null,8,["selected","tabs"])]),e.createElementVNode("div",P,[e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",T,[e.createVNode(V.default,{modelValue:a.state.user.phone,"onUpdate:modelValue":s[1]||(s[1]=t=>a.state.user.phone=t),dropdownOptions:{showDialCodeInSelection:!0,showFlags:!0,showDialCodeInList:!0},validation:d.value,mode:"national",inputOptions:{placeholder:e.unref(l)("phonePlaceholder")},class:"bg-grey pd-small radius-small mn-thin"},null,8,["modelValue","validation","inputOptions"])],512),[[e.vShow,n.value==="phone"]])]),_:1}),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",I,[e.createVNode(c.default,{field:a.state.user.email,"onUpdate:field":s[2]||(s[2]=t=>a.state.user.email=t),placeholder:e.unref(l)("emailPlaceholder"),validation:u.value,class:"bg-grey pd-medium radius-small"},null,8,["field","placeholder","validation"])],512),[[e.vShow,n.value==="email"]])]),_:1})]),e.createVNode(c.default,{field:a.state.user.password,"onUpdate:field":s[3]||(s[3]=t=>a.state.user.password=t),type:"password",validation:m.value,placeholder:e.unref(l)("passwordPlaceholder"),class:"bg-grey pd-medium radius-small mn-semi"},null,8,["field","validation","placeholder"]),e.createElementVNode("div",U,[e.createVNode(i,{to:"/auth/reset-password",class:"underline d-block t-blue"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("forgotPassword")),1)]),_:1})]),e.createVNode(w.default,{submit:v,callback:_,class:"mn-thin"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("signin")),1)]),_:1})])}}};exports.default=k;
|