@eaccess/auth 0.1.17 → 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 +14 -2
- 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 +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -723,7 +723,7 @@ var BaseOAuthProvider = class {
|
|
|
723
723
|
if (existingProvider) {
|
|
724
724
|
const account2 = await queries.findAccountById(existingProvider.account_id);
|
|
725
725
|
if (account2) {
|
|
726
|
-
await this.authManager.onLoginSuccessful(account2,
|
|
726
|
+
await this.authManager.onLoginSuccessful(account2, true);
|
|
727
727
|
return { isNewUser: false };
|
|
728
728
|
}
|
|
729
729
|
}
|
|
@@ -758,7 +758,7 @@ var BaseOAuthProvider = class {
|
|
|
758
758
|
providerName: userData.name || null,
|
|
759
759
|
providerAvatar: userData.avatar || null
|
|
760
760
|
});
|
|
761
|
-
await this.authManager.onLoginSuccessful(account,
|
|
761
|
+
await this.authManager.onLoginSuccessful(account, true);
|
|
762
762
|
return { isNewUser: true };
|
|
763
763
|
}
|
|
764
764
|
async exchangeCodeForToken(code, tokenUrl) {
|
|
@@ -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,
|