@cedarjs/auth-dbauth-web 8.0.0-canary.3274 → 8.0.0-canary.3285
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/dbAuth.d.ts +7 -2
- package/dist/dbAuth.d.ts.map +1 -1
- package/dist/dbAuth.js +10 -0
- package/package.json +3 -3
package/dist/dbAuth.d.ts
CHANGED
|
@@ -8,14 +8,18 @@ export interface ResetPasswordAttributes {
|
|
|
8
8
|
resetToken: string;
|
|
9
9
|
password: string;
|
|
10
10
|
}
|
|
11
|
+
export interface ChangePasswordAttributes {
|
|
12
|
+
currentPassword: string;
|
|
13
|
+
newPassword: string;
|
|
14
|
+
}
|
|
11
15
|
export type SignupAttributes = Record<string, unknown> & LoginAttributes;
|
|
12
16
|
export declare function createAuth(dbAuthClient: ReturnType<typeof createDbAuthClient>, customProviderHooks?: {
|
|
13
17
|
useCurrentUser?: () => Promise<CurrentUser>;
|
|
14
18
|
useHasRole?: (currentUser: CurrentUser | null) => (rolesToCheck: string | string[]) => boolean;
|
|
15
19
|
}): {
|
|
16
|
-
AuthContext: import("react").Context<import("@cedarjs/auth").AuthContextInterface<string | (() => void), LoginAttributes, any, unknown, boolean, SignupAttributes, any, any, ResetPasswordAttributes, any, any, import("./webAuthn.js").default> | undefined>;
|
|
20
|
+
AuthContext: import("react").Context<import("@cedarjs/auth").AuthContextInterface<string | (() => void), LoginAttributes, any, unknown, boolean, SignupAttributes, any, any, ResetPasswordAttributes, any, any, import("./webAuthn.js").default, ChangePasswordAttributes, any> | undefined>;
|
|
17
21
|
AuthProvider: ({ children }: import("@cedarjs/auth").AuthProviderProps) => import("react").JSX.Element;
|
|
18
|
-
useAuth: () => import("@cedarjs/auth").AuthContextInterface<string | (() => void), LoginAttributes, any, unknown, boolean, SignupAttributes, any, any, ResetPasswordAttributes, any, any, import("./webAuthn.js").default>;
|
|
22
|
+
useAuth: () => import("@cedarjs/auth").AuthContextInterface<string | (() => void), LoginAttributes, any, unknown, boolean, SignupAttributes, any, any, ResetPasswordAttributes, any, any, import("./webAuthn.js").default, ChangePasswordAttributes, any>;
|
|
19
23
|
};
|
|
20
24
|
export interface DbAuthClientArgs {
|
|
21
25
|
webAuthn?: InstanceType<WebAuthnClientType>;
|
|
@@ -36,6 +40,7 @@ export declare function createDbAuthClient({ webAuthn, dbAuthUrl, fetchConfig, m
|
|
|
36
40
|
forgotPassword: (username: string) => Promise<any>;
|
|
37
41
|
resetPassword: (attributes: ResetPasswordAttributes) => Promise<any>;
|
|
38
42
|
validateResetToken: (resetToken: string | null) => Promise<any>;
|
|
43
|
+
changePassword: (attributes: ChangePasswordAttributes) => Promise<any>;
|
|
39
44
|
getAuthUrl: () => string;
|
|
40
45
|
middlewareAuthEnabled: boolean;
|
|
41
46
|
};
|
package/dist/dbAuth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbAuth.d.ts","sourceRoot":"","sources":["../src/dbAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAA;AAMrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAAA;AAkBxE,wBAAgB,UAAU,CACxB,YAAY,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,EACnD,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WAAW,GAAG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AY,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAA;CAClD;;;;EAOF;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;KACxC,CAAA;IACD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAA4C,GAC7C,GAAE,gBAAqB;;;oCAwFuB,eAAe;;yBAgC1B,gBAAgB;;;+BA9EV,MAAM;gCAmEL,uBAAuB;qCAsBlB,MAAM,GAAG,IAAI;iCApGjB,wBAAwB;;;EAyInE"}
|
package/dist/dbAuth.js
CHANGED
|
@@ -44,6 +44,15 @@ function createDbAuthClient({
|
|
|
44
44
|
lastTokenCheckAt = /* @__PURE__ */ new Date("1970-01-01T00:00:00");
|
|
45
45
|
cachedToken = null;
|
|
46
46
|
};
|
|
47
|
+
const changePassword = async (attributes) => {
|
|
48
|
+
const response = await resetAndFetch(getDbAuthUrl(), {
|
|
49
|
+
credentials,
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: { "Content-Type": "application/json" },
|
|
52
|
+
body: JSON.stringify({ ...attributes, method: "changePassword" })
|
|
53
|
+
});
|
|
54
|
+
return response.json();
|
|
55
|
+
};
|
|
47
56
|
const forgotPassword = async (username) => {
|
|
48
57
|
const response = await resetAndFetch(getDbAuthUrl(), {
|
|
49
58
|
credentials,
|
|
@@ -135,6 +144,7 @@ function createDbAuthClient({
|
|
|
135
144
|
forgotPassword,
|
|
136
145
|
resetPassword,
|
|
137
146
|
validateResetToken,
|
|
147
|
+
changePassword,
|
|
138
148
|
// New methods for middleware auth:
|
|
139
149
|
// This is so we can get the dbAuthUrl in getCurrentUserFromMiddleware
|
|
140
150
|
getAuthUrl: getDbAuthUrl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/auth-dbauth-web",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3285",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"test:watch": "vitest watch"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@cedarjs/auth": "8.0.0-canary.
|
|
48
|
+
"@cedarjs/auth": "8.0.0-canary.3285",
|
|
49
49
|
"@simplewebauthn/browser": "13.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
52
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3285",
|
|
53
53
|
"@types/react": "^19.2.0",
|
|
54
54
|
"concurrently": "9.2.4",
|
|
55
55
|
"publint": "0.3.24",
|