@eaccess/auth 0.1.18 → 0.1.19
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 +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,7 @@ interface AuthSession {
|
|
|
149
149
|
lastRememberCheck: Date;
|
|
150
150
|
forceLogout: number;
|
|
151
151
|
verified: boolean;
|
|
152
|
+
hasPassword: boolean;
|
|
152
153
|
shouldForceLogout?: boolean;
|
|
153
154
|
awaitingTwoFactor?: {
|
|
154
155
|
accountId: number;
|
|
@@ -285,6 +286,7 @@ interface AuthManager$1 {
|
|
|
285
286
|
getEmail(): string | null;
|
|
286
287
|
getStatus(): number | null;
|
|
287
288
|
getVerified(): boolean | null;
|
|
289
|
+
hasPassword(): boolean | null;
|
|
288
290
|
getRoleNames(rolemask?: number): string[];
|
|
289
291
|
getStatusName(): string | null;
|
|
290
292
|
hasRole(role: number): Promise<boolean>;
|
|
@@ -977,6 +979,12 @@ declare class AuthManager implements AuthManager$1 {
|
|
|
977
979
|
* @returns true if verified, false if unverified, null if not logged in
|
|
978
980
|
*/
|
|
979
981
|
getVerified(): boolean | null;
|
|
982
|
+
/**
|
|
983
|
+
* Check if the current user has a password set.
|
|
984
|
+
* OAuth-only users will return false.
|
|
985
|
+
* @returns true if user has a password, false if OAuth-only, null if not logged in
|
|
986
|
+
*/
|
|
987
|
+
hasPassword(): boolean | null;
|
|
980
988
|
/**
|
|
981
989
|
* Get human-readable role names for the current user or a specific rolemask.
|
|
982
990
|
* @param rolemask - Optional specific rolemask to check. If omitted, uses current user's roles
|
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ interface AuthSession {
|
|
|
149
149
|
lastRememberCheck: Date;
|
|
150
150
|
forceLogout: number;
|
|
151
151
|
verified: boolean;
|
|
152
|
+
hasPassword: boolean;
|
|
152
153
|
shouldForceLogout?: boolean;
|
|
153
154
|
awaitingTwoFactor?: {
|
|
154
155
|
accountId: number;
|
|
@@ -285,6 +286,7 @@ interface AuthManager$1 {
|
|
|
285
286
|
getEmail(): string | null;
|
|
286
287
|
getStatus(): number | null;
|
|
287
288
|
getVerified(): boolean | null;
|
|
289
|
+
hasPassword(): boolean | null;
|
|
288
290
|
getRoleNames(rolemask?: number): string[];
|
|
289
291
|
getStatusName(): string | null;
|
|
290
292
|
hasRole(role: number): Promise<boolean>;
|
|
@@ -977,6 +979,12 @@ declare class AuthManager implements AuthManager$1 {
|
|
|
977
979
|
* @returns true if verified, false if unverified, null if not logged in
|
|
978
980
|
*/
|
|
979
981
|
getVerified(): boolean | null;
|
|
982
|
+
/**
|
|
983
|
+
* Check if the current user has a password set.
|
|
984
|
+
* OAuth-only users will return false.
|
|
985
|
+
* @returns true if user has a password, false if OAuth-only, null if not logged in
|
|
986
|
+
*/
|
|
987
|
+
hasPassword(): boolean | null;
|
|
980
988
|
/**
|
|
981
989
|
* Get human-readable role names for the current user or a specific rolemask.
|
|
982
990
|
* @param rolemask - Optional specific rolemask to check. If omitted, uses current user's roles
|
package/dist/index.js
CHANGED
|
@@ -1744,6 +1744,7 @@ var AuthManager = class {
|
|
|
1744
1744
|
this.req.session.auth.status = account.status;
|
|
1745
1745
|
this.req.session.auth.rolemask = account.rolemask;
|
|
1746
1746
|
this.req.session.auth.verified = account.verified;
|
|
1747
|
+
this.req.session.auth.hasPassword = account.password !== null;
|
|
1747
1748
|
this.req.session.auth.lastResync = /* @__PURE__ */ new Date();
|
|
1748
1749
|
}
|
|
1749
1750
|
async processRememberDirective() {
|
|
@@ -1797,6 +1798,7 @@ var AuthManager = class {
|
|
|
1797
1798
|
lastRememberCheck: /* @__PURE__ */ new Date(),
|
|
1798
1799
|
forceLogout: account.force_logout,
|
|
1799
1800
|
verified: account.verified,
|
|
1801
|
+
hasPassword: account.password !== null,
|
|
1800
1802
|
shouldForceLogout: false
|
|
1801
1803
|
};
|
|
1802
1804
|
this.req.session.auth = session;
|
|
@@ -1883,6 +1885,7 @@ var AuthManager = class {
|
|
|
1883
1885
|
lastRememberCheck: /* @__PURE__ */ new Date(),
|
|
1884
1886
|
forceLogout: 0,
|
|
1885
1887
|
verified: false,
|
|
1888
|
+
hasPassword: false,
|
|
1886
1889
|
awaitingTwoFactor: {
|
|
1887
1890
|
accountId: account.id,
|
|
1888
1891
|
expiresAt,
|
|
@@ -2021,6 +2024,14 @@ var AuthManager = class {
|
|
|
2021
2024
|
getVerified() {
|
|
2022
2025
|
return this.req.session?.auth?.verified ?? null;
|
|
2023
2026
|
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Check if the current user has a password set.
|
|
2029
|
+
* OAuth-only users will return false.
|
|
2030
|
+
* @returns true if user has a password, false if OAuth-only, null if not logged in
|
|
2031
|
+
*/
|
|
2032
|
+
hasPassword() {
|
|
2033
|
+
return this.req.session?.auth?.hasPassword ?? null;
|
|
2034
|
+
}
|
|
2024
2035
|
/**
|
|
2025
2036
|
* Get human-readable role names for the current user or a specific rolemask.
|
|
2026
2037
|
* @param rolemask - Optional specific rolemask to check. If omitted, uses current user's roles
|
|
@@ -2169,6 +2180,7 @@ var AuthManager = class {
|
|
|
2169
2180
|
lastRememberCheck: /* @__PURE__ */ new Date(),
|
|
2170
2181
|
forceLogout: 0,
|
|
2171
2182
|
verified: false,
|
|
2183
|
+
hasPassword: false,
|
|
2172
2184
|
awaitingTwoFactor: {
|
|
2173
2185
|
accountId: account.id,
|
|
2174
2186
|
expiresAt,
|