@umituz/web-dashboard 3.1.7 → 3.1.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"description": "Dashboard Layout System - Comprehensive analytics, calendar, customizable layouts, and config-based architecture",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -19,6 +19,7 @@ export const LoginForm = ({
|
|
|
19
19
|
showForgotPassword = true,
|
|
20
20
|
showRegisterLink = true,
|
|
21
21
|
showSocialLogin,
|
|
22
|
+
onLoginAttempt,
|
|
22
23
|
onLoginSuccess,
|
|
23
24
|
onLoginError,
|
|
24
25
|
onGoogleLogin,
|
|
@@ -47,20 +48,26 @@ export const LoginForm = ({
|
|
|
47
48
|
setIsLoading(true);
|
|
48
49
|
|
|
49
50
|
try {
|
|
50
|
-
|
|
51
|
-
// const user = await login({ email, password });
|
|
51
|
+
let user: { id: string; email: string; name?: string };
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// Use custom login handler if provided (real auth), otherwise use mock auth
|
|
54
|
+
if (onLoginAttempt) {
|
|
55
|
+
// Real authentication flow
|
|
56
|
+
user = await onLoginAttempt({ email, password });
|
|
57
|
+
} else {
|
|
58
|
+
// Mock authentication flow (for development/demo)
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
60
|
+
user = {
|
|
61
|
+
id: "1",
|
|
62
|
+
email,
|
|
63
|
+
name: email.split("@")[0],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
55
66
|
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
id: "1",
|
|
59
|
-
email,
|
|
60
|
-
name: email.split("@")[0],
|
|
61
|
-
};
|
|
67
|
+
// Call success callback
|
|
68
|
+
await onLoginSuccess?.(user);
|
|
62
69
|
|
|
63
|
-
|
|
70
|
+
// Navigate to after-login route
|
|
64
71
|
navigate(config.afterLoginRoute);
|
|
65
72
|
} catch (err) {
|
|
66
73
|
const errorMessage = err instanceof Error ? err.message : "Login failed";
|
|
@@ -19,6 +19,7 @@ export const RegisterForm = ({
|
|
|
19
19
|
showLoginLink = true,
|
|
20
20
|
requirePasswordConfirm = true,
|
|
21
21
|
showSocialLogin,
|
|
22
|
+
onRegisterAttempt,
|
|
22
23
|
onRegisterSuccess,
|
|
23
24
|
onRegisterError,
|
|
24
25
|
onGoogleLogin,
|
|
@@ -61,20 +62,26 @@ export const RegisterForm = ({
|
|
|
61
62
|
setIsLoading(true);
|
|
62
63
|
|
|
63
64
|
try {
|
|
64
|
-
|
|
65
|
-
// const user = await register({ email, password, name, metadata });
|
|
65
|
+
let user: { id: string; email: string; name?: string };
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
|
|
67
|
+
// Use custom register handler if provided (real auth), otherwise use mock auth
|
|
68
|
+
if (onRegisterAttempt) {
|
|
69
|
+
// Real authentication flow
|
|
70
|
+
user = await onRegisterAttempt({ email, password, name });
|
|
71
|
+
} else {
|
|
72
|
+
// Mock authentication flow (for development/demo)
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
74
|
+
user = {
|
|
75
|
+
id: "1",
|
|
76
|
+
email,
|
|
77
|
+
name: name || email.split("@")[0],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
69
80
|
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
id: "1",
|
|
73
|
-
email,
|
|
74
|
-
name: name || email.split("@")[0],
|
|
75
|
-
};
|
|
81
|
+
// Call success callback
|
|
82
|
+
await onRegisterSuccess?.(user);
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
// Navigate to after-login route
|
|
78
85
|
navigate(config.afterLoginRoute);
|
|
79
86
|
} catch (err) {
|
|
80
87
|
const errorMessage = err instanceof Error ? err.message : "Registration failed";
|
|
@@ -212,7 +212,9 @@ export interface LoginFormProps {
|
|
|
212
212
|
showRegisterLink?: boolean;
|
|
213
213
|
/** Show social login buttons */
|
|
214
214
|
showSocialLogin?: boolean;
|
|
215
|
-
/**
|
|
215
|
+
/** Custom login handler (receives credentials, returns user) - overrides mock auth */
|
|
216
|
+
onLoginAttempt?: (credentials: LoginCredentials) => Promise<User>;
|
|
217
|
+
/** On successful login (called after onLoginAttempt or mock auth succeeds) */
|
|
216
218
|
onLoginSuccess?: (user: User) => void | Promise<void>;
|
|
217
219
|
/** On login error */
|
|
218
220
|
onLoginError?: (error: string) => void;
|
|
@@ -238,7 +240,9 @@ export interface RegisterFormProps {
|
|
|
238
240
|
requirePasswordConfirm?: boolean;
|
|
239
241
|
/** Show social login buttons */
|
|
240
242
|
showSocialLogin?: boolean;
|
|
241
|
-
/**
|
|
243
|
+
/** Custom register handler (receives register data, returns user) - overrides mock auth */
|
|
244
|
+
onRegisterAttempt?: (data: RegisterData) => Promise<User>;
|
|
245
|
+
/** On successful registration (called after onRegisterAttempt or mock auth succeeds) */
|
|
242
246
|
onRegisterSuccess?: (user: User) => void | Promise<void>;
|
|
243
247
|
/** On registration error */
|
|
244
248
|
onRegisterError?: (error: string) => void;
|