@eaccess/auth 0.1.15 → 0.1.17
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/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -39,6 +39,11 @@ interface AuthConfig {
|
|
|
39
39
|
maxPasswordLength?: number;
|
|
40
40
|
rememberDuration?: string;
|
|
41
41
|
rememberCookieName?: string;
|
|
42
|
+
cookie?: {
|
|
43
|
+
domain?: string;
|
|
44
|
+
secure?: boolean;
|
|
45
|
+
sameSite?: "strict" | "lax" | "none";
|
|
46
|
+
};
|
|
42
47
|
resyncInterval?: string;
|
|
43
48
|
activityLog?: {
|
|
44
49
|
enabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ interface AuthConfig {
|
|
|
39
39
|
maxPasswordLength?: number;
|
|
40
40
|
rememberDuration?: string;
|
|
41
41
|
rememberCookieName?: string;
|
|
42
|
+
cookie?: {
|
|
43
|
+
domain?: string;
|
|
44
|
+
secure?: boolean;
|
|
45
|
+
sameSite?: "strict" | "lax" | "none";
|
|
46
|
+
};
|
|
42
47
|
resyncInterval?: string;
|
|
43
48
|
activityLog?: {
|
|
44
49
|
enabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1678,13 +1678,20 @@ var AuthManager = class {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
setRememberCookie(token, expires) {
|
|
1680
1680
|
const cookieName = this.config.rememberCookieName || "remember_token";
|
|
1681
|
+
const cookieConfig = this.config.cookie || {};
|
|
1681
1682
|
if (token === null) {
|
|
1682
|
-
this.res.clearCookie(cookieName
|
|
1683
|
+
this.res.clearCookie(cookieName, {
|
|
1684
|
+
domain: cookieConfig.domain,
|
|
1685
|
+
secure: cookieConfig.secure ?? this.req.secure,
|
|
1686
|
+
sameSite: cookieConfig.sameSite
|
|
1687
|
+
});
|
|
1683
1688
|
} else {
|
|
1684
1689
|
this.res.cookie(cookieName, token, {
|
|
1685
1690
|
expires,
|
|
1686
1691
|
httpOnly: true,
|
|
1687
|
-
secure: this.req.secure
|
|
1692
|
+
secure: cookieConfig.secure ?? this.req.secure,
|
|
1693
|
+
domain: cookieConfig.domain,
|
|
1694
|
+
sameSite: cookieConfig.sameSite
|
|
1688
1695
|
});
|
|
1689
1696
|
}
|
|
1690
1697
|
}
|
|
@@ -1764,7 +1771,7 @@ var AuthManager = class {
|
|
|
1764
1771
|
this.setRememberCookie(null, /* @__PURE__ */ new Date(0));
|
|
1765
1772
|
return;
|
|
1766
1773
|
}
|
|
1767
|
-
await this.onLoginSuccessful(account,
|
|
1774
|
+
await this.onLoginSuccessful(account, false);
|
|
1768
1775
|
}
|
|
1769
1776
|
async onLoginSuccessful(account, remember = false) {
|
|
1770
1777
|
await this.queries.updateAccountLastLogin(account.id);
|