@authing/ng-ui-components 2.4.62-rc.6 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Authing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -3837,25 +3837,25 @@
|
|
|
3837
3837
|
case 10: return e.prev = 10, g(!1), e.finish(10);
|
|
3838
3838
|
case 13:
|
|
3839
3839
|
case "end": return e.stop();
|
|
3840
|
-
} }), e, null, [[0, 7, 10, 13]]); }))); return function (t) { return e.apply(this, arguments); }; }(); return d.a.createElement(d.a.Fragment, null, d.a.createElement("h3", { className: "authing-guard-mfa-title" }, s("login.accPwdLoginVerify")), d.a.createElement("p", { className: "authing-guard-mfa-tips" }, s("login.inputSixCode")), d.a.createElement(re.a, { form: u, onSubmitCapture: function () { return g(!0); }, onFinish: y, onFinishFailed: function () { return g(!1); } }, d.a.createElement(re.a.Item, { name: "mfaCode", rules: [{ validateTrigger: [], validator: function () { return l.some((function (e) { return !e; })) ? Promise.reject(s("login.inputFullMfaCode")) : Promise.resolve(); } }] }, d.a.createElement(pt, { verifyCode: l, setVerifyCode: p })), d.a.createElement(Le.a, { className: "authing-guard-mfa-confirm-btn", loading: m, block: !0, htmlType: "submit", type: "primary", size: "large" }, s("common.sure")), d.a.createElement("div", { className: "authing-guard-form-actions" }, d.a.createElement("div", { className: "authing-guard-tip-btn-comb" }, d.a.createElement("span", { className: "authing-guard-tip" }, s("common.hasLooseSaftyCode")), d.a.createElement(Le.a, { htmlType: "button", onClick: r, className: "authing-guard-text-btn", type: "text" }, s("common.useRecoverCode")))))); }), mt = Object(f.forwardRef)((function (e, t) { var n = e.onSuccess, r = e.onValidateFail, o = e.onFail, i = Ye().t, a = x().state, s = a.
|
|
3840
|
+
} }), e, null, [[0, 7, 10, 13]]); }))); return function (t) { return e.apply(this, arguments); }; }(); return d.a.createElement(d.a.Fragment, null, d.a.createElement("h3", { className: "authing-guard-mfa-title" }, s("login.accPwdLoginVerify")), d.a.createElement("p", { className: "authing-guard-mfa-tips" }, s("login.inputSixCode")), d.a.createElement(re.a, { form: u, onSubmitCapture: function () { return g(!0); }, onFinish: y, onFinishFailed: function () { return g(!1); } }, d.a.createElement(re.a.Item, { name: "mfaCode", rules: [{ validateTrigger: [], validator: function () { return l.some((function (e) { return !e; })) ? Promise.reject(s("login.inputFullMfaCode")) : Promise.resolve(); } }] }, d.a.createElement(pt, { verifyCode: l, setVerifyCode: p })), d.a.createElement(Le.a, { className: "authing-guard-mfa-confirm-btn", loading: m, block: !0, htmlType: "submit", type: "primary", size: "large" }, s("common.sure")), d.a.createElement("div", { className: "authing-guard-form-actions" }, d.a.createElement("div", { className: "authing-guard-tip-btn-comb" }, d.a.createElement("span", { className: "authing-guard-tip" }, s("common.hasLooseSaftyCode")), d.a.createElement(Le.a, { htmlType: "button", onClick: r, className: "authing-guard-text-btn", type: "text" }, s("common.useRecoverCode")))))); }), mt = Object(f.forwardRef)((function (e, t) { var n = e.onSuccess, r = e.onValidateFail, o = e.onFail, i = Ye().t, a = x().state, s = a.authClient, u = a.realHost, c = a.guardEvents, p = v(re.a.useForm(), 1)[0], h = v(Object(f.useState)(!1), 2), m = h[0], g = h[1], y = v(Object(f.useState)(null), 2), b = y[0], w = y[1], E = v(Object(f.useState)(!1), 2), C = E[0], S = E[1], P = "".concat(u, "/api/v2/security/captcha"), T = function () { return "".concat(P, "?r=").concat(+new Date); }, j = function () { var e = _(O.a.mark((function e(t) { var r, i, a, u; return O.a.wrap((function (e) { for (;;)
|
|
3841
3841
|
switch (e.prev = e.next) {
|
|
3842
3842
|
case 0:
|
|
3843
|
-
if (!
|
|
3843
|
+
if (!c.onBeforeLogin) {
|
|
3844
3844
|
e.next = 15;
|
|
3845
3845
|
break;
|
|
3846
3846
|
}
|
|
3847
|
-
return e.prev = 1, e.next = 4,
|
|
3847
|
+
return e.prev = 1, e.next = 4, c.onBeforeLogin({ type: k.LoginMethods.LDAP, data: { identity: t.identity, password: t.password, captchaCode: t.captchaCode } }, s);
|
|
3848
3848
|
case 4:
|
|
3849
3849
|
if (e.sent) {
|
|
3850
3850
|
e.next = 8;
|
|
3851
3851
|
break;
|
|
3852
3852
|
}
|
|
3853
|
-
return
|
|
3853
|
+
return S(!1), e.abrupt("return");
|
|
3854
3854
|
case 8:
|
|
3855
3855
|
e.next = 15;
|
|
3856
3856
|
break;
|
|
3857
|
-
case 10: return e.prev = 10, e.t0 = e.catch(1), "string" === typeof e.t0 ? l.a.error(e.t0) : l.a.error(e.t0.message),
|
|
3858
|
-
case 15: return e.prev = 15, r = t.identity && t.identity.trim(), i = t.password && t.password.trim(), e.next = 20,
|
|
3857
|
+
case 10: return e.prev = 10, e.t0 = e.catch(1), "string" === typeof e.t0 ? l.a.error(e.t0) : l.a.error(e.t0.message), S(!1), e.abrupt("return");
|
|
3858
|
+
case 15: return e.prev = 15, r = t.identity && t.identity.trim(), i = t.password && t.password.trim(), e.next = 20, s.loginByLdap(r, i);
|
|
3859
3859
|
case 20:
|
|
3860
3860
|
a = e.sent, n && n(a), e.next = 37;
|
|
3861
3861
|
break;
|
|
@@ -3864,13 +3864,13 @@
|
|
|
3864
3864
|
e.next = 35;
|
|
3865
3865
|
break;
|
|
3866
3866
|
}
|
|
3867
|
-
return e.prev = 27,
|
|
3867
|
+
return e.prev = 27, u = JSON.parse(e.t1.message), o && o(u), e.abrupt("return");
|
|
3868
3868
|
case 33: e.prev = 33, e.t2 = e.catch(27);
|
|
3869
|
-
case 35: e.t1.code === I.d && null ===
|
|
3870
|
-
case 37: return e.prev = 37,
|
|
3869
|
+
case 35: e.t1.code === I.d && null === b && (g(!0), w(T())), o && o(e.t1);
|
|
3870
|
+
case 37: return e.prev = 37, S(!1), e.finish(37);
|
|
3871
3871
|
case 40:
|
|
3872
3872
|
case "end": return e.stop();
|
|
3873
|
-
} }), e, null, [[1, 10], [15, 24, 37, 40], [27, 33]]); }))); return function (t) { return e.apply(this, arguments); }; }(); Object(f.useImperativeHandle)(t, (function () { return
|
|
3873
|
+
} }), e, null, [[1, 10], [15, 24, 37, 40], [27, 33]]); }))); return function (t) { return e.apply(this, arguments); }; }(); Object(f.useImperativeHandle)(t, (function () { return p; })); var A = [{ component: d.a.createElement(te.a, { autoComplete: "ldap,username", size: "large", placeholder: i("login.inputLdapUsername"), prefix: d.a.createElement(Te, { style: { color: "#ddd" } }) }), name: "identity", rules: $(i("common.LDAPAccountNotNull")) }, { component: d.a.createElement(te.a.Password, { size: "large", placeholder: i("login.inputLdapPwd"), prefix: d.a.createElement(Ne, { style: { color: "#ddd" } }) }), name: "password", rules: $(i("common.passwordNotNull")) }, { component: d.a.createElement(te.a, { size: "large", placeholder: i("login.inputCaptchaCode"), addonAfter: d.a.createElement("img", { src: null !== b && void 0 !== b ? b : "", alt: i("login.captchaCode"), style: { height: "2em", cursor: "pointer" }, onClick: function () { return w(T()); } }) }), name: "captchaCode", rules: $(i("common.captchaCodeNotNull")), hide: !m }]; return d.a.createElement(re.a, { form: p, onSubmitCapture: function () { return S(!0); }, onFinishFailed: function (e) { S(!1), r && r(e); }, onFinish: j }, A.map((function (e) { return !e.hide && d.a.createElement(re.a.Item, { key: e.name, name: e.name, rules: e.rules }, e.component); })), d.a.createElement(Qe, { loading: C })); })), vt = (n(410), function (e) { var t = e.onFail, n = e.onSuccess, r = e.type, o = e.idpId, a = x().state, u = a.authClient, c = a.config, l = Object(f.useRef)(), p = Object(f.useMemo)((function () { var e; return (e = {}, Object(i.a)(e, k.LoginMethods.AppQr, u.qrcode), Object(i.a)(e, k.LoginMethods.WxMinQr, u.wxqrcode), Object(i.a)(e, k.LoginMethods.WechatMpQrcode, u.wechatmpqrcode), e)[r]; }), [r, u]); return Object(f.useEffect)((function () { return p.startScanning("authingGuardQrcode", s(s({ extIdpConnId: o, autoExchangeUserInfo: !0 }, c.qrCodeScanOptions), {}, { onStart: function (e) { l.current = e; }, onSuccess: function (e) { n && n(e); }, onError: function (e) { var n, r; null === (n = c.qrCodeScanOptions) || void 0 === n || null === (r = n.onError) || void 0 === r || r.call(n, e), t && t("".concat(e)); } })), function () { return clearInterval(l.current); }; }), [p, c.qrCodeScanOptions, o, t, n]), d.a.createElement("div", { className: "authing-guard-qr-form" }, d.a.createElement("div", { className: "authing-guard-qr-loading" }, d.a.createElement(L.a, { size: "large" })), d.a.createElement("div", { id: "authingGuardQrcode" })); }), gt = function (e) { var t = e.mfaToken, n = e.onSuccess, r = e.goVerify, o = e.onFail, i = v(Object(f.useState)(!1), 2), a = i[0], s = i[1], u = Ye().t, c = x().state.authClient, l = function () { var e = _(O.a.mark((function e(r) { var i; return O.a.wrap((function (e) { for (;;)
|
|
3874
3874
|
switch (e.prev = e.next) {
|
|
3875
3875
|
case 0: return e.prev = 0, e.next = 3, c.mfa.verifyTotpRecoveryCode({ recoveryCode: r.recoverCode, mfaToken: t });
|
|
3876
3876
|
case 3:
|