@mohasinac/appkit 4.6.0 → 4.6.2

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.
@@ -71,6 +71,12 @@ const rawTesterChecklistItems = [
71
71
  { key: "avatar-upload", label: "Uploading a profile avatar works" },
72
72
  { key: "notification-prefs", label: "Notification preferences save correctly" },
73
73
  { key: "public-profile-toggle", label: "Public profile visibility toggle works" },
74
+ {
75
+ key: "password-change-otp-required",
76
+ label: "Changing your password from Settings requires entering an emailed 6-digit code before it actually takes effect — the password does not change just from submitting the current/new password form",
77
+ description: "Fixed 2026-08-20 — the password-change API previously trusted the session cookie alone, with no server-side check of the current password at all. Submit the Change Password form with a correct current password; confirm you land on a \"we sent a code to your email\" step, and the password only actually updates after entering the correct code. Also verify: an expired/wrong code is rejected with a clear error, and \"Resend code\" works.",
78
+ href: "/user/settings",
79
+ },
74
80
  {
75
81
  key: "own-public-profile-quick-links",
76
82
  label: "\"View public profile\" is easy to find and works from three places: the My Account dashboard header, the My Account quick-links grid (\"My Public Profile\" tile), and the /user/profile page (next to \"Manage Addresses\")",
@@ -14,6 +14,8 @@ export declare class FirebaseClientAuthProvider implements IClientAuthProvider {
14
14
  applyActionCode(code: string): Promise<void>;
15
15
  sendPasswordResetEmail(email: string): Promise<void>;
16
16
  confirmPasswordReset(code: string, newPassword: string): Promise<void>;
17
+ /** Re-authenticates the current user against `currentPassword`, returning the now-fresh user. Throws if no user is signed in. */
18
+ private _reauthenticate;
17
19
  reauthenticateAndChangePassword(currentPassword: string, newPassword: string): Promise<void>;
18
20
  reauthenticateOnly(currentPassword: string): Promise<void>;
19
21
  reauthenticateAndSendEmailUpdateVerification(currentPassword: string, newEmail: string): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { applyActionCode as fbApplyActionCode, confirmPasswordReset as fbConfirmPasswordReset, EmailAuthProvider, reauthenticateWithCredential, sendPasswordResetEmail as fbSendPasswordResetEmail, signInWithEmailAndPassword as fbSignInWithEmailAndPassword, updatePassword, verifyBeforeUpdateEmail, } from "firebase/auth";
2
+ const NO_AUTHENTICATED_USER_MESSAGE = "No authenticated user.";
2
3
  /**
3
4
  * Firebase Auth client SDK implementation of IClientAuthProvider.
4
5
  *
@@ -22,27 +23,24 @@ export class FirebaseClientAuthProvider {
22
23
  async confirmPasswordReset(code, newPassword) {
23
24
  await fbConfirmPasswordReset(this._auth, code, newPassword);
24
25
  }
25
- async reauthenticateAndChangePassword(currentPassword, newPassword) {
26
+ /** Re-authenticates the current user against `currentPassword`, returning the now-fresh user. Throws if no user is signed in. */
27
+ async _reauthenticate(currentPassword) {
26
28
  const user = this._auth.currentUser;
27
29
  if (!user?.email)
28
- throw new Error("No authenticated user.");
30
+ throw new Error(NO_AUTHENTICATED_USER_MESSAGE);
29
31
  const credential = EmailAuthProvider.credential(user.email, currentPassword);
30
32
  await reauthenticateWithCredential(user, credential);
33
+ return user;
34
+ }
35
+ async reauthenticateAndChangePassword(currentPassword, newPassword) {
36
+ const user = await this._reauthenticate(currentPassword);
31
37
  await updatePassword(user, newPassword);
32
38
  }
33
39
  async reauthenticateOnly(currentPassword) {
34
- const user = this._auth.currentUser;
35
- if (!user?.email)
36
- throw new Error("No authenticated user.");
37
- const credential = EmailAuthProvider.credential(user.email, currentPassword);
38
- await reauthenticateWithCredential(user, credential);
40
+ await this._reauthenticate(currentPassword);
39
41
  }
40
42
  async reauthenticateAndSendEmailUpdateVerification(currentPassword, newEmail) {
41
- const user = this._auth.currentUser;
42
- if (!user?.email)
43
- throw new Error("No authenticated user.");
44
- const credential = EmailAuthProvider.credential(user.email, currentPassword);
45
- await reauthenticateWithCredential(user, credential);
43
+ const user = await this._reauthenticate(currentPassword);
46
44
  await verifyBeforeUpdateEmail(user, newEmail);
47
45
  }
48
46
  async reloadCurrentUser() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"