authhero 0.132.0 → 0.133.0
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/dist/authhero.cjs +3 -3
- package/dist/authhero.mjs +52 -35
- package/package.json +1 -1
package/dist/authhero.mjs
CHANGED
|
@@ -5640,18 +5640,24 @@ async function oo(t, e) {
|
|
|
5640
5640
|
};
|
|
5641
5641
|
}
|
|
5642
5642
|
async function N0(t, e) {
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5643
|
+
if (!e.loginSession) {
|
|
5644
|
+
const { ip: r, useragent: i, auth0Client: s } = jt(t.req);
|
|
5645
|
+
e.loginSession = await t.env.data.loginSessions.create(
|
|
5646
|
+
e.client.tenant.id,
|
|
5647
|
+
{
|
|
5648
|
+
expires_at: new Date(
|
|
5649
|
+
Date.now() + nr * 1e3
|
|
5650
|
+
).toISOString(),
|
|
5651
|
+
authParams: e.authParams,
|
|
5652
|
+
authorization_url: t.req.url,
|
|
5653
|
+
csrf_token: Se(),
|
|
5654
|
+
ip: r,
|
|
5655
|
+
useragent: i,
|
|
5656
|
+
auth0Client: s
|
|
5657
|
+
}
|
|
5658
|
+
);
|
|
5659
|
+
}
|
|
5660
|
+
return {
|
|
5655
5661
|
code: (await t.env.data.codes.create(e.client.tenant.id, {
|
|
5656
5662
|
code_id: Se(),
|
|
5657
5663
|
user_id: e.user.user_id,
|
|
@@ -18510,14 +18516,19 @@ async function Sv(t, e, n, r) {
|
|
|
18510
18516
|
e.tenant.id,
|
|
18511
18517
|
r.state
|
|
18512
18518
|
);
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18519
|
+
if (!s) {
|
|
18520
|
+
const { ip: d, useragent: l, auth0Client: u } = jt(t.req);
|
|
18521
|
+
s = await t.env.data.loginSessions.create(e.tenant.id, {
|
|
18522
|
+
expires_at: new Date(
|
|
18523
|
+
Date.now() + nr * 1e3
|
|
18524
|
+
).toISOString(),
|
|
18525
|
+
authParams: r,
|
|
18526
|
+
csrf_token: Se(),
|
|
18527
|
+
ip: d,
|
|
18528
|
+
useragent: l,
|
|
18529
|
+
auth0Client: u
|
|
18530
|
+
});
|
|
18531
|
+
}
|
|
18521
18532
|
const a = await Og(t, i.strategy).getRedirect(t, i);
|
|
18522
18533
|
return await t.env.data.codes.create(e.tenant.id, {
|
|
18523
18534
|
login_id: s.id,
|
|
@@ -21497,30 +21508,32 @@ const Gb = new ae().openapi(
|
|
|
21497
21508
|
message: "Client not found"
|
|
21498
21509
|
});
|
|
21499
21510
|
t.set("client_id", a.id), t.set("tenant_id", a.tenant.id);
|
|
21500
|
-
const d = o === "email" ? e.email : e.phone_number, l = await n.data.loginSessions.create(
|
|
21511
|
+
const d = o === "email" ? e.email : e.phone_number, { ip: l, useragent: u, auth0Client: f } = jt(t.req), m = await n.data.loginSessions.create(
|
|
21501
21512
|
a.tenant.id,
|
|
21502
21513
|
{
|
|
21503
21514
|
authParams: { ...s, client_id: r, username: d },
|
|
21504
21515
|
expires_at: new Date(Date.now() + Da).toISOString(),
|
|
21505
21516
|
csrf_token: Se(),
|
|
21506
|
-
|
|
21517
|
+
ip: l,
|
|
21518
|
+
useragent: u,
|
|
21519
|
+
auth0Client: f
|
|
21507
21520
|
}
|
|
21508
|
-
),
|
|
21521
|
+
), w = await n.data.codes.create(a.tenant.id, {
|
|
21509
21522
|
code_id: Mn(),
|
|
21510
21523
|
code_type: "otp",
|
|
21511
|
-
login_id:
|
|
21524
|
+
login_id: m.id,
|
|
21512
21525
|
expires_at: new Date(Date.now() + Da).toISOString()
|
|
21513
21526
|
});
|
|
21514
21527
|
return i === "link" ? await Tl(t, {
|
|
21515
21528
|
to: d,
|
|
21516
|
-
code:
|
|
21529
|
+
code: w.code_id,
|
|
21517
21530
|
authParams: {
|
|
21518
21531
|
...s,
|
|
21519
21532
|
client_id: r
|
|
21520
21533
|
}
|
|
21521
21534
|
}) : await Kg(t, {
|
|
21522
21535
|
to: d,
|
|
21523
|
-
code:
|
|
21536
|
+
code: w.code_id
|
|
21524
21537
|
}), t.html("OK");
|
|
21525
21538
|
}
|
|
21526
21539
|
).openapi(
|
|
@@ -21690,7 +21703,7 @@ async function Wb(t, e, n, r) {
|
|
|
21690
21703
|
i,
|
|
21691
21704
|
"password_reset"
|
|
21692
21705
|
);
|
|
21693
|
-
const o = await t.env.data.loginSessions.create(
|
|
21706
|
+
const { ip: o, useragent: a, auth0Client: d } = jt(t.req), l = await t.env.data.loginSessions.create(
|
|
21694
21707
|
e.tenant.id,
|
|
21695
21708
|
{
|
|
21696
21709
|
expires_at: new Date(
|
|
@@ -21701,17 +21714,19 @@ async function Wb(t, e, n, r) {
|
|
|
21701
21714
|
username: n
|
|
21702
21715
|
},
|
|
21703
21716
|
csrf_token: Se(),
|
|
21704
|
-
|
|
21717
|
+
ip: o,
|
|
21718
|
+
useragent: a,
|
|
21719
|
+
auth0Client: d
|
|
21705
21720
|
}
|
|
21706
|
-
),
|
|
21721
|
+
), u = await t.env.data.codes.create(e.tenant.id, {
|
|
21707
21722
|
code_id: i,
|
|
21708
21723
|
code_type: "password_reset",
|
|
21709
|
-
login_id:
|
|
21724
|
+
login_id: l.id,
|
|
21710
21725
|
expires_at: new Date(
|
|
21711
21726
|
Date.now() + V1
|
|
21712
21727
|
).toISOString()
|
|
21713
21728
|
});
|
|
21714
|
-
await Hg(t, n,
|
|
21729
|
+
await Hg(t, n, u.code_id, r);
|
|
21715
21730
|
}
|
|
21716
21731
|
const Jb = new ae().openapi(
|
|
21717
21732
|
M({
|
|
@@ -21763,7 +21778,7 @@ const Jb = new ae().openapi(
|
|
|
21763
21778
|
message: "Client not found"
|
|
21764
21779
|
});
|
|
21765
21780
|
t.set("client_id", n), t.set("tenant_id", i.tenant.id);
|
|
21766
|
-
const s = r.toLocaleLowerCase();
|
|
21781
|
+
const s = r.toLocaleLowerCase(), o = jt(t.req);
|
|
21767
21782
|
if ("otp" in e)
|
|
21768
21783
|
return Il(
|
|
21769
21784
|
t,
|
|
@@ -21774,7 +21789,7 @@ const Jb = new ae().openapi(
|
|
|
21774
21789
|
!0
|
|
21775
21790
|
);
|
|
21776
21791
|
if ("password" in e) {
|
|
21777
|
-
const
|
|
21792
|
+
const a = await t.env.data.loginSessions.create(
|
|
21778
21793
|
i.tenant.id,
|
|
21779
21794
|
{
|
|
21780
21795
|
expires_at: new Date(
|
|
@@ -21785,7 +21800,9 @@ const Jb = new ae().openapi(
|
|
|
21785
21800
|
username: s
|
|
21786
21801
|
},
|
|
21787
21802
|
csrf_token: Se(),
|
|
21788
|
-
|
|
21803
|
+
ip: o.ip,
|
|
21804
|
+
useragent: o.useragent,
|
|
21805
|
+
auth0Client: o.auth0Client
|
|
21789
21806
|
}
|
|
21790
21807
|
);
|
|
21791
21808
|
return Rl(
|
|
@@ -21796,7 +21813,7 @@ const Jb = new ae().openapi(
|
|
|
21796
21813
|
password: e.password,
|
|
21797
21814
|
client_id: n
|
|
21798
21815
|
},
|
|
21799
|
-
|
|
21816
|
+
a,
|
|
21800
21817
|
!0
|
|
21801
21818
|
);
|
|
21802
21819
|
} else
|