@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 CHANGED
@@ -1833,6 +1833,7 @@ var AuthManager = class {
1833
1833
  this.req.session.auth.status = account.status;
1834
1834
  this.req.session.auth.rolemask = account.rolemask;
1835
1835
  this.req.session.auth.verified = account.verified;
1836
+ this.req.session.auth.hasPassword = account.password !== null;
1836
1837
  this.req.session.auth.lastResync = /* @__PURE__ */ new Date();
1837
1838
  }
1838
1839
  async processRememberDirective() {
@@ -1886,6 +1887,7 @@ var AuthManager = class {
1886
1887
  lastRememberCheck: /* @__PURE__ */ new Date(),
1887
1888
  forceLogout: account.force_logout,
1888
1889
  verified: account.verified,
1890
+ hasPassword: account.password !== null,
1889
1891
  shouldForceLogout: false
1890
1892
  };
1891
1893
  this.req.session.auth = session;
@@ -1972,6 +1974,7 @@ var AuthManager = class {
1972
1974
  lastRememberCheck: /* @__PURE__ */ new Date(),
1973
1975
  forceLogout: 0,
1974
1976
  verified: false,
1977
+ hasPassword: false,
1975
1978
  awaitingTwoFactor: {
1976
1979
  accountId: account.id,
1977
1980
  expiresAt,
@@ -2110,6 +2113,14 @@ var AuthManager = class {
2110
2113
  getVerified() {
2111
2114
  return this.req.session?.auth?.verified ?? null;
2112
2115
  }
2116
+ /**
2117
+ * Check if the current user has a password set.
2118
+ * OAuth-only users will return false.
2119
+ * @returns true if user has a password, false if OAuth-only, null if not logged in
2120
+ */
2121
+ hasPassword() {
2122
+ return this.req.session?.auth?.hasPassword ?? null;
2123
+ }
2113
2124
  /**
2114
2125
  * Get human-readable role names for the current user or a specific rolemask.
2115
2126
  * @param rolemask - Optional specific rolemask to check. If omitted, uses current user's roles
@@ -2258,6 +2269,7 @@ var AuthManager = class {
2258
2269
  lastRememberCheck: /* @__PURE__ */ new Date(),
2259
2270
  forceLogout: 0,
2260
2271
  verified: false,
2272
+ hasPassword: false,
2261
2273
  awaitingTwoFactor: {
2262
2274
  accountId: account.id,
2263
2275
  expiresAt,