@micha.bigler/ui-core-micha 2.3.1 → 2.3.3

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.
@@ -3,21 +3,20 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
3
3
  //
4
4
  // S13: Completes a pending registration. Reads the signed pending-token from
5
5
  // the URL (`?token=...`), asks the user for a password, and POSTs to
6
- // `register_confirm`. On success, the user is logged in by the backend session
7
- // cookie; we hand off to AuthContext.login so the SPA picks it up immediately.
8
- import React, { useContext, useMemo, useState } from 'react';
6
+ // `register_confirm`. On success, the user is sent to /login to sign in
7
+ // explicitly matches the existing invite/password-reset pattern and
8
+ // preserves any MFA / login-event flow the app may enforce.
9
+ import React, { useMemo, useState } from 'react';
9
10
  import { useLocation, useNavigate } from 'react-router-dom';
10
11
  import { Alert, Box, Button, Stack, TextField, Typography, } from '@mui/material';
11
12
  import { Helmet } from 'react-helmet';
12
13
  import { useTranslation } from 'react-i18next';
13
14
  import { NarrowPage } from '../layout/PageLayout';
14
- import { AuthContext } from '../auth/AuthContext';
15
- import { confirmRegistration, fetchCurrentUser } from '../auth/authApi';
15
+ import { confirmRegistration } from '../auth/authApi';
16
16
  export function SignupConfirmPage() {
17
17
  const { t } = useTranslation();
18
18
  const location = useLocation();
19
19
  const navigate = useNavigate();
20
- const { login } = useContext(AuthContext);
21
20
  const tokenFromUrl = useMemo(() => {
22
21
  const query = new URLSearchParams(location.search);
23
22
  return query.get('token') || '';
@@ -44,16 +43,11 @@ export function SignupConfirmPage() {
44
43
  setSubmitting(true);
45
44
  try {
46
45
  await confirmRegistration({ token: tokenFromUrl, password });
47
- // Refresh user state from session before navigating home.
48
- try {
49
- const user = await fetchCurrentUser();
50
- login(user);
51
- }
52
- catch (_a) {
53
- // If user fetch fails, still navigate — the session cookie is set
54
- // server-side and the next page-load will pick the user up.
55
- }
56
- navigate('/', { replace: true });
46
+ // Send the user to /login. Aligned with PasswordInvitePage; no implicit
47
+ // session that would bypass MFA challenges or skip the explicit login
48
+ // event in audit logs.
49
+ navigate('/login', { replace: true });
50
+ return;
57
51
  }
58
52
  catch (err) {
59
53
  setErrorKey((err === null || err === void 0 ? void 0 : err.code) || 'Auth.PENDING_TOKEN_INVALID');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "repository": {
@@ -2,9 +2,10 @@
2
2
  //
3
3
  // S13: Completes a pending registration. Reads the signed pending-token from
4
4
  // the URL (`?token=...`), asks the user for a password, and POSTs to
5
- // `register_confirm`. On success, the user is logged in by the backend session
6
- // cookie; we hand off to AuthContext.login so the SPA picks it up immediately.
7
- import React, { useContext, useMemo, useState } from 'react';
5
+ // `register_confirm`. On success, the user is sent to /login to sign in
6
+ // explicitly matches the existing invite/password-reset pattern and
7
+ // preserves any MFA / login-event flow the app may enforce.
8
+ import React, { useMemo, useState } from 'react';
8
9
  import { useLocation, useNavigate } from 'react-router-dom';
9
10
  import {
10
11
  Alert,
@@ -17,14 +18,12 @@ import {
17
18
  import { Helmet } from 'react-helmet';
18
19
  import { useTranslation } from 'react-i18next';
19
20
  import { NarrowPage } from '../layout/PageLayout';
20
- import { AuthContext } from '../auth/AuthContext';
21
- import { confirmRegistration, fetchCurrentUser } from '../auth/authApi';
21
+ import { confirmRegistration } from '../auth/authApi';
22
22
 
23
23
  export function SignupConfirmPage() {
24
24
  const { t } = useTranslation();
25
25
  const location = useLocation();
26
26
  const navigate = useNavigate();
27
- const { login } = useContext(AuthContext);
28
27
 
29
28
  const tokenFromUrl = useMemo(() => {
30
29
  const query = new URLSearchParams(location.search);
@@ -56,15 +55,11 @@ export function SignupConfirmPage() {
56
55
  setSubmitting(true);
57
56
  try {
58
57
  await confirmRegistration({ token: tokenFromUrl, password });
59
- // Refresh user state from session before navigating home.
60
- try {
61
- const user = await fetchCurrentUser();
62
- login(user);
63
- } catch {
64
- // If user fetch fails, still navigate — the session cookie is set
65
- // server-side and the next page-load will pick the user up.
66
- }
67
- navigate('/', { replace: true });
58
+ // Send the user to /login. Aligned with PasswordInvitePage; no implicit
59
+ // session that would bypass MFA challenges or skip the explicit login
60
+ // event in audit logs.
61
+ navigate('/login', { replace: true });
62
+ return;
68
63
  } catch (err) {
69
64
  setErrorKey(err?.code || 'Auth.PENDING_TOKEN_INVALID');
70
65
  } finally {