@owox/idp-better-auth 0.5.0
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/README.md +183 -0
- package/dist/adapters/database.d.ts +29 -0
- package/dist/adapters/database.d.ts.map +1 -0
- package/dist/adapters/database.js +85 -0
- package/dist/auth/auth-config.d.ts +4 -0
- package/dist/auth/auth-config.d.ts.map +1 -0
- package/dist/auth/auth-config.js +72 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/providers/better-auth-provider.d.ts +34 -0
- package/dist/providers/better-auth-provider.d.ts.map +1 -0
- package/dist/providers/better-auth-provider.js +99 -0
- package/dist/services/authentication-service.d.ts +23 -0
- package/dist/services/authentication-service.d.ts.map +1 -0
- package/dist/services/authentication-service.js +199 -0
- package/dist/services/crypto-service.d.ts +18 -0
- package/dist/services/crypto-service.d.ts.map +1 -0
- package/dist/services/crypto-service.js +100 -0
- package/dist/services/database-service.d.ts +14 -0
- package/dist/services/database-service.d.ts.map +1 -0
- package/dist/services/database-service.js +142 -0
- package/dist/services/magic-link-service.d.ts +10 -0
- package/dist/services/magic-link-service.d.ts.map +1 -0
- package/dist/services/magic-link-service.js +42 -0
- package/dist/services/middleware-service.d.ts +15 -0
- package/dist/services/middleware-service.d.ts.map +1 -0
- package/dist/services/middleware-service.js +38 -0
- package/dist/services/page-service.d.ts +23 -0
- package/dist/services/page-service.d.ts.map +1 -0
- package/dist/services/page-service.js +331 -0
- package/dist/services/request-handler-service.d.ts +10 -0
- package/dist/services/request-handler-service.d.ts.map +1 -0
- package/dist/services/request-handler-service.js +50 -0
- package/dist/services/template-service.d.ts +28 -0
- package/dist/services/template-service.d.ts.map +1 -0
- package/dist/services/template-service.js +198 -0
- package/dist/services/token-service.d.ts +15 -0
- package/dist/services/token-service.d.ts.map +1 -0
- package/dist/services/token-service.js +108 -0
- package/dist/services/user-management-service.d.ts +74 -0
- package/dist/services/user-management-service.d.ts.map +1 -0
- package/dist/services/user-management-service.js +396 -0
- package/dist/templates/admin-add-user.html +298 -0
- package/dist/templates/admin-dashboard.html +214 -0
- package/dist/templates/admin-user-details.html +278 -0
- package/dist/templates/password-setup.html +267 -0
- package/dist/templates/password-success.html +197 -0
- package/dist/templates/sign-in.html +201 -0
- package/dist/types/auth-session.d.ts +25 -0
- package/dist/types/auth-session.d.ts.map +1 -0
- package/dist/types/auth-session.js +1 -0
- package/dist/types/database-models.d.ts +54 -0
- package/dist/types/database-models.d.ts.map +1 -0
- package/dist/types/database-models.js +1 -0
- package/dist/types/index.d.ts +45 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/package.json +69 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Password Set Successfully - IDP Better Auth</title>
|
|
7
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
tailwind.config = {
|
|
11
|
+
theme: {
|
|
12
|
+
extend: {
|
|
13
|
+
colors: {
|
|
14
|
+
// OWOX Design System Colors
|
|
15
|
+
background: "oklch(1 0 0)",
|
|
16
|
+
foreground: "oklch(0.3346 0.0123 279.25)",
|
|
17
|
+
card: "oklch(1 0 0)",
|
|
18
|
+
'card-foreground': "oklch(0.3346 0.0123 279.25)",
|
|
19
|
+
popover: "oklch(1 0 0)",
|
|
20
|
+
'popover-foreground': "oklch(0.3346 0.0123 279.25)",
|
|
21
|
+
primary: {
|
|
22
|
+
DEFAULT: "oklch(0.6179 0.2295 250.87)",
|
|
23
|
+
hover: "oklch(0.54 0.23 250.87)",
|
|
24
|
+
foreground: "oklch(0.985 0 0)",
|
|
25
|
+
},
|
|
26
|
+
secondary: {
|
|
27
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
28
|
+
foreground: "oklch(0.205 0 0)",
|
|
29
|
+
},
|
|
30
|
+
muted: {
|
|
31
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
32
|
+
foreground: "oklch(0.5148 0.0128 274.72)",
|
|
33
|
+
},
|
|
34
|
+
accent: {
|
|
35
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
36
|
+
foreground: "oklch(0.205 0 0)",
|
|
37
|
+
},
|
|
38
|
+
destructive: {
|
|
39
|
+
DEFAULT: "oklch(0.577 0.245 27.325)",
|
|
40
|
+
foreground: "oklch(0.985 0 0)",
|
|
41
|
+
},
|
|
42
|
+
border: "oklch(0.922 0 0)",
|
|
43
|
+
input: "oklch(0.922 0 0)",
|
|
44
|
+
ring: "oklch(0.708 0 0)",
|
|
45
|
+
success: {
|
|
46
|
+
DEFAULT: "oklch(0.647 0.165 142.495)",
|
|
47
|
+
foreground: "oklch(0.985 0 0)",
|
|
48
|
+
},
|
|
49
|
+
'brand-blue': {
|
|
50
|
+
50: "oklch(0.985 0.03 250.87)",
|
|
51
|
+
100: "oklch(0.955 0.05 250.87)",
|
|
52
|
+
200: "oklch(0.9 0.08 250.87)",
|
|
53
|
+
300: "oklch(0.8 0.14 250.87)",
|
|
54
|
+
400: "oklch(0.7 0.19 250.87)",
|
|
55
|
+
500: "oklch(0.6179 0.2295 250.87)",
|
|
56
|
+
600: "oklch(0.54 0.23 250.87)",
|
|
57
|
+
700: "oklch(0.44 0.2 250.87)",
|
|
58
|
+
800: "oklch(0.36 0.17 250.87)",
|
|
59
|
+
900: "oklch(0.28 0.14 250.87)",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
</head>
|
|
67
|
+
<body class="min-h-screen bg-background flex flex-col justify-center py-12 sm:px-6 lg:px-8">
|
|
68
|
+
<!-- Header ---->
|
|
69
|
+
<div class="sm:mx-auto sm:w-full sm:max-w-md">
|
|
70
|
+
<div class="flex justify-center">
|
|
71
|
+
<div class="w-16 h-16 bg-success rounded-full flex items-center justify-center">
|
|
72
|
+
<svg class="w-10 h-10 text-primary-foreground" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
73
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
74
|
+
</svg>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<h2 class="mt-6 text-center text-3xl font-bold tracking-tight text-foreground">
|
|
78
|
+
Password Set Successfully!
|
|
79
|
+
</h2>
|
|
80
|
+
<p class="mt-2 text-center text-sm text-muted-foreground">
|
|
81
|
+
Your account is now ready to use
|
|
82
|
+
</p>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- Success Card -->
|
|
86
|
+
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
87
|
+
<div class="bg-card py-8 px-4 shadow-sm rounded-lg sm:px-10 border border-border">
|
|
88
|
+
<!-- Success Message -->
|
|
89
|
+
<div class="bg-success/10 border border-success/20 rounded-md p-4 mb-6">
|
|
90
|
+
<div class="flex">
|
|
91
|
+
<div class="flex-shrink-0">
|
|
92
|
+
<svg class="h-5 w-5 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
93
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
94
|
+
</svg>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="ml-3">
|
|
97
|
+
<h3 class="text-sm font-medium text-success-foreground">
|
|
98
|
+
Account Setup Complete
|
|
99
|
+
</h3>
|
|
100
|
+
<div class="mt-2 text-sm text-success">
|
|
101
|
+
<p>Your password has been set successfully and your account is now active.</p>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<!-- Features List -->
|
|
108
|
+
<div class="space-y-4 mb-8">
|
|
109
|
+
<div class="flex items-start">
|
|
110
|
+
<div class="flex-shrink-0">
|
|
111
|
+
<svg class="h-5 w-5 text-green-500 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
112
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
|
|
113
|
+
</svg>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="ml-3">
|
|
116
|
+
<p class="text-sm font-medium text-foreground">Secure authentication enabled</p>
|
|
117
|
+
<p class="text-sm text-muted-foreground">Your account is protected with encrypted password</p>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="flex items-start">
|
|
122
|
+
<div class="flex-shrink-0">
|
|
123
|
+
<svg class="h-5 w-5 text-green-500 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
124
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path>
|
|
125
|
+
</svg>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="ml-3">
|
|
128
|
+
<p class="text-sm font-medium text-foreground">Organization access granted</p>
|
|
129
|
+
<p class="text-sm text-muted-foreground">You can now access your organization resources</p>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div class="flex items-start">
|
|
134
|
+
<div class="flex-shrink-0">
|
|
135
|
+
<svg class="h-5 w-5 text-green-500 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
136
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
137
|
+
</svg>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="ml-3">
|
|
140
|
+
<p class="text-sm font-medium text-foreground">Ready to get started</p>
|
|
141
|
+
<p class="text-sm text-muted-foreground">Your profile has been set up and verified</p>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<!-- Action Button -->
|
|
147
|
+
<div>
|
|
148
|
+
<button
|
|
149
|
+
onclick="window.location.href='/'"
|
|
150
|
+
class="group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md text-primary-foreground bg-primary hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring transition-colors"
|
|
151
|
+
>
|
|
152
|
+
<span class="absolute left-0 inset-y-0 flex items-center pl-3">
|
|
153
|
+
<svg class="h-4 w-4 text-primary-foreground group-hover:text-primary-foreground/90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
154
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
|
|
155
|
+
</svg>
|
|
156
|
+
</span>
|
|
157
|
+
Continue to Application
|
|
158
|
+
</button>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div class="mt-6 text-center">
|
|
162
|
+
<p class="text-xs text-muted-foreground">
|
|
163
|
+
Need help? Contact your administrator for assistance.
|
|
164
|
+
</p>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<!-- Footer -->
|
|
170
|
+
<div class="mt-8 text-center">
|
|
171
|
+
<p class="text-xs text-muted-foreground">
|
|
172
|
+
Powered by <strong>OWOX Data Marts</strong>
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<script>
|
|
177
|
+
// Auto-redirect after 5 seconds (optional)
|
|
178
|
+
let countdown = 10;
|
|
179
|
+
const updateCountdown = () => {
|
|
180
|
+
if (countdown > 0) {
|
|
181
|
+
const button = document.querySelector('button[onclick*="window.location.href=\'/\'"]');
|
|
182
|
+
if (button && countdown <= 10) {
|
|
183
|
+
button.innerHTML = button.innerHTML.replace(/\(\d+s\)/, '') + ` (${countdown}s)`;
|
|
184
|
+
}
|
|
185
|
+
countdown--;
|
|
186
|
+
setTimeout(updateCountdown, 1000);
|
|
187
|
+
} else {
|
|
188
|
+
// Auto redirect after countdown
|
|
189
|
+
// window.location.href = '/';
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Uncomment to enable auto-redirect
|
|
194
|
+
// setTimeout(updateCountdown, 1000);
|
|
195
|
+
</script>
|
|
196
|
+
</body>
|
|
197
|
+
</html>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Sign In - IDP Better Auth</title>
|
|
7
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
|
+
<script>
|
|
9
|
+
tailwind.config = {
|
|
10
|
+
theme: {
|
|
11
|
+
extend: {
|
|
12
|
+
colors: {
|
|
13
|
+
// OWOX Design System Colors
|
|
14
|
+
background: "oklch(1 0 0)",
|
|
15
|
+
foreground: "oklch(0.3346 0.0123 279.25)",
|
|
16
|
+
card: "oklch(1 0 0)",
|
|
17
|
+
'card-foreground': "oklch(0.3346 0.0123 279.25)",
|
|
18
|
+
popover: "oklch(1 0 0)",
|
|
19
|
+
'popover-foreground': "oklch(0.3346 0.0123 279.25)",
|
|
20
|
+
primary: {
|
|
21
|
+
DEFAULT: "oklch(0.6179 0.2295 250.87)",
|
|
22
|
+
hover: "oklch(0.54 0.23 250.87)",
|
|
23
|
+
foreground: "oklch(0.985 0 0)",
|
|
24
|
+
},
|
|
25
|
+
secondary: {
|
|
26
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
27
|
+
foreground: "oklch(0.205 0 0)",
|
|
28
|
+
},
|
|
29
|
+
muted: {
|
|
30
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
31
|
+
foreground: "oklch(0.5148 0.0128 274.72)",
|
|
32
|
+
},
|
|
33
|
+
accent: {
|
|
34
|
+
DEFAULT: "oklch(0.97 0 0)",
|
|
35
|
+
foreground: "oklch(0.205 0 0)",
|
|
36
|
+
},
|
|
37
|
+
destructive: {
|
|
38
|
+
DEFAULT: "oklch(0.577 0.245 27.325)",
|
|
39
|
+
foreground: "oklch(0.985 0 0)",
|
|
40
|
+
},
|
|
41
|
+
border: "oklch(0.922 0 0)",
|
|
42
|
+
input: "oklch(0.922 0 0)",
|
|
43
|
+
ring: "oklch(0.708 0 0)",
|
|
44
|
+
// Brand blue colors
|
|
45
|
+
'brand-blue': {
|
|
46
|
+
50: "oklch(0.985 0.03 250.87)",
|
|
47
|
+
100: "oklch(0.955 0.05 250.87)",
|
|
48
|
+
200: "oklch(0.9 0.08 250.87)",
|
|
49
|
+
300: "oklch(0.8 0.14 250.87)",
|
|
50
|
+
400: "oklch(0.7 0.19 250.87)",
|
|
51
|
+
500: "oklch(0.6179 0.2295 250.87)",
|
|
52
|
+
600: "oklch(0.54 0.23 250.87)",
|
|
53
|
+
700: "oklch(0.44 0.2 250.87)",
|
|
54
|
+
800: "oklch(0.36 0.17 250.87)",
|
|
55
|
+
900: "oklch(0.28 0.14 250.87)",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
</head>
|
|
63
|
+
<body class="min-h-screen bg-background flex flex-col justify-center py-12 sm:px-6 lg:px-8">
|
|
64
|
+
<!-- Header -->
|
|
65
|
+
<div class="sm:mx-auto sm:w-full sm:max-w-md">
|
|
66
|
+
<div class="flex justify-center">
|
|
67
|
+
<div class="w-12 h-12 bg-primary rounded-lg flex items-center justify-center">
|
|
68
|
+
<svg class="w-8 h-8 text-primary-foreground" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
69
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
|
|
70
|
+
</svg>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<h2 class="mt-6 text-center text-3xl font-bold tracking-tight text-foreground">
|
|
74
|
+
OWOX Data Marts
|
|
75
|
+
</h2>
|
|
76
|
+
<p class="mt-2 text-center text-sm text-muted-foreground">
|
|
77
|
+
Sign in to your account to continue
|
|
78
|
+
</p>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<!-- Sign In Form -->
|
|
82
|
+
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
83
|
+
<div class="bg-card py-8 px-4 shadow-sm rounded-lg sm:px-10 border border-border">
|
|
84
|
+
<form class="space-y-6" action="/auth/api/sign-in/" method="post" id="signInForm">
|
|
85
|
+
<div>
|
|
86
|
+
<label for="email" class="block text-sm font-medium text-card-foreground">
|
|
87
|
+
Email address
|
|
88
|
+
</label>
|
|
89
|
+
<div class="mt-1 relative">
|
|
90
|
+
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
91
|
+
<svg class="h-4 w-4 text-muted-foreground" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
92
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"></path>
|
|
93
|
+
</svg>
|
|
94
|
+
</div>
|
|
95
|
+
<input
|
|
96
|
+
id="email"
|
|
97
|
+
name="email"
|
|
98
|
+
type="email"
|
|
99
|
+
autocomplete="email"
|
|
100
|
+
required
|
|
101
|
+
class="appearance-none block w-full pl-10 pr-3 py-2 border border-input bg-background rounded-md placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-ring sm:text-sm transition-colors"
|
|
102
|
+
placeholder="Enter your email"
|
|
103
|
+
>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div>
|
|
108
|
+
<label for="password" class="block text-sm font-medium text-card-foreground">
|
|
109
|
+
Password
|
|
110
|
+
</label>
|
|
111
|
+
<div class="mt-1 relative">
|
|
112
|
+
<input
|
|
113
|
+
id="password"
|
|
114
|
+
name="password"
|
|
115
|
+
type="password"
|
|
116
|
+
autocomplete="current-password"
|
|
117
|
+
required
|
|
118
|
+
class="appearance-none block w-full pl-10 pr-10 py-2 border border-input bg-background rounded-md placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-ring sm:text-sm transition-colors"
|
|
119
|
+
placeholder="Enter your password"
|
|
120
|
+
>
|
|
121
|
+
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
122
|
+
<svg class="h-4 w-4 text-muted-foreground" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
123
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
|
|
124
|
+
</svg>
|
|
125
|
+
</div>
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
onclick="togglePassword()"
|
|
129
|
+
class="absolute inset-y-0 right-0 pr-3 flex items-center"
|
|
130
|
+
>
|
|
131
|
+
<svg id="eye-open" class="h-4 w-4 text-muted-foreground hover:text-foreground transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
132
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
|
133
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
|
|
134
|
+
</svg>
|
|
135
|
+
<svg id="eye-closed" class="h-4 w-4 text-muted-foreground hover:text-foreground transition-colors hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
136
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L21 21"></path>
|
|
137
|
+
</svg>
|
|
138
|
+
</button>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div>
|
|
143
|
+
<button
|
|
144
|
+
type="submit"
|
|
145
|
+
class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-primary hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition-colors"
|
|
146
|
+
>
|
|
147
|
+
<span class="absolute left-0 inset-y-0 flex items-center pl-3">
|
|
148
|
+
<svg class="h-4 w-4 text-primary-foreground group-hover:text-primary-foreground/90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
149
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path>
|
|
150
|
+
</svg>
|
|
151
|
+
</span>
|
|
152
|
+
Sign In
|
|
153
|
+
</button>
|
|
154
|
+
</div>
|
|
155
|
+
</form>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<!-- Footer -->
|
|
160
|
+
<div class="mt-8 text-center">
|
|
161
|
+
<p class="text-xs text-muted-foreground">
|
|
162
|
+
Powered by <strong>OWOX Data Marts</strong>
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<script>
|
|
167
|
+
function togglePassword() {
|
|
168
|
+
const passwordInput = document.getElementById('password');
|
|
169
|
+
const eyeOpen = document.getElementById('eye-open');
|
|
170
|
+
const eyeClosed = document.getElementById('eye-closed');
|
|
171
|
+
|
|
172
|
+
if (passwordInput.type === 'password') {
|
|
173
|
+
passwordInput.type = 'text';
|
|
174
|
+
eyeOpen.classList.add('hidden');
|
|
175
|
+
eyeClosed.classList.remove('hidden');
|
|
176
|
+
} else {
|
|
177
|
+
passwordInput.type = 'password';
|
|
178
|
+
eyeOpen.classList.remove('hidden');
|
|
179
|
+
eyeClosed.classList.add('hidden');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Show error message if present in URL
|
|
184
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
185
|
+
const error = urlParams.get('error');
|
|
186
|
+
if (error) {
|
|
187
|
+
const errorDiv = document.createElement('div');
|
|
188
|
+
errorDiv.className = 'mb-4 p-4 text-sm text-destructive bg-destructive/10 border border-destructive/20 rounded-md';
|
|
189
|
+
errorDiv.innerHTML = `
|
|
190
|
+
<div class="flex items-center">
|
|
191
|
+
<svg class="w-4 h-4 mr-2 text-destructive" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
192
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
193
|
+
</svg>
|
|
194
|
+
<span class="text-destructive">${decodeURIComponent(error)}</span>
|
|
195
|
+
</div>
|
|
196
|
+
`;
|
|
197
|
+
document.querySelector('form').insertBefore(errorDiv, document.querySelector('form').firstChild);
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
200
|
+
</body>
|
|
201
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Better Auth session data
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthSession {
|
|
5
|
+
user: {
|
|
6
|
+
id: string;
|
|
7
|
+
email: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
};
|
|
10
|
+
session: {
|
|
11
|
+
id: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
token: string;
|
|
14
|
+
expiresAt: Date;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Session validation result
|
|
19
|
+
*/
|
|
20
|
+
export interface SessionValidationResult {
|
|
21
|
+
isValid: boolean;
|
|
22
|
+
session?: AuthSession;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=auth-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-session.d.ts","sourceRoot":"","sources":["../../src/types/auth-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,IAAI,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database user model
|
|
3
|
+
*/
|
|
4
|
+
export interface DatabaseUser {
|
|
5
|
+
id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Database session model
|
|
12
|
+
*/
|
|
13
|
+
export interface DatabaseSession {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
token: string;
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
createdAt?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Database account model
|
|
22
|
+
*/
|
|
23
|
+
export interface DatabaseAccount {
|
|
24
|
+
id: string;
|
|
25
|
+
userId: string;
|
|
26
|
+
providerId: string;
|
|
27
|
+
accountId: string;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Database organization member model
|
|
32
|
+
*/
|
|
33
|
+
export interface DatabaseMember {
|
|
34
|
+
id: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
organizationId: string;
|
|
37
|
+
role: string;
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
user?: DatabaseUser;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Organization list members response
|
|
43
|
+
*/
|
|
44
|
+
export interface OrganizationMembersResponse {
|
|
45
|
+
members: DatabaseMember[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Database operation result
|
|
49
|
+
*/
|
|
50
|
+
export interface DatabaseOperationResult {
|
|
51
|
+
changes: number;
|
|
52
|
+
lastInsertRowid?: number;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=database-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-models.d.ts","sourceRoot":"","sources":["../../src/types/database-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface SqliteConfig {
|
|
5
|
+
type: 'sqlite';
|
|
6
|
+
filename?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* MySQL database configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface MySqlConfig {
|
|
12
|
+
type: 'mysql';
|
|
13
|
+
host: string;
|
|
14
|
+
user: string;
|
|
15
|
+
password: string;
|
|
16
|
+
database: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
}
|
|
19
|
+
export type Role = 'admin' | 'editor' | 'viewer';
|
|
20
|
+
/**
|
|
21
|
+
* Custom database adapter (for advanced use cases)
|
|
22
|
+
*/
|
|
23
|
+
export interface CustomDatabaseConfig {
|
|
24
|
+
type: 'custom';
|
|
25
|
+
adapter: unknown;
|
|
26
|
+
}
|
|
27
|
+
export type DatabaseConfig = SqliteConfig | MySqlConfig | CustomDatabaseConfig;
|
|
28
|
+
export interface BetterAuthConfig {
|
|
29
|
+
database: DatabaseConfig;
|
|
30
|
+
emailAndPassword?: {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
requireEmailVerification?: boolean;
|
|
33
|
+
sendEmailVerification?: (email: string, url: string, token: string) => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
session?: {
|
|
36
|
+
maxAge?: number;
|
|
37
|
+
};
|
|
38
|
+
trustedOrigins?: string[];
|
|
39
|
+
baseURL?: string;
|
|
40
|
+
secret: string;
|
|
41
|
+
magicLinkTll?: number;
|
|
42
|
+
}
|
|
43
|
+
export * from './auth-session.js';
|
|
44
|
+
export * from './database-models.js';
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,gBAAgB,CAAC,EAAE;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACtF,CAAC;IACF,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@owox/idp-better-auth",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "OWOX",
|
|
6
|
+
"license": "ELv2",
|
|
7
|
+
"description": "Better Auth implementation for OWOX IDP Protocol",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22.16.0"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc && node ./scripts/copy-public.cjs",
|
|
16
|
+
"build:dep": "npm run build:idp-protocol",
|
|
17
|
+
"build:idp-protocol": "npm run build -w @owox/idp-protocol --prefix ../..",
|
|
18
|
+
"clean": "rimraf dist",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"lint": "eslint . --config ./eslint.config.js",
|
|
21
|
+
"lint:fix": "eslint . --fix --config ./eslint.config.js",
|
|
22
|
+
"format": "prettier --write \"**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore",
|
|
23
|
+
"format:check": "prettier --check \"**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"prepack": "npm run build",
|
|
26
|
+
"prepublishOnly": "npm audit && npm run lint && npm run typecheck"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"idp",
|
|
30
|
+
"better-auth",
|
|
31
|
+
"authentication",
|
|
32
|
+
"owox"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@owox/idp-protocol": "0.5.0",
|
|
36
|
+
"@types/cookie-parser": "^1.4.9",
|
|
37
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
38
|
+
"better-auth": "^1.3.4",
|
|
39
|
+
"better-sqlite3": "^12.2.0",
|
|
40
|
+
"cookie-parser": "^1.4.7",
|
|
41
|
+
"env-paths": "^3.0.0",
|
|
42
|
+
"jsonwebtoken": "^9.0.0",
|
|
43
|
+
"mysql2": "^3.14.3",
|
|
44
|
+
"zod": "^3.25.67"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
48
|
+
"@types/jest": "^29.5.14",
|
|
49
|
+
"@types/node": "^22.10.7",
|
|
50
|
+
"eslint": "^9.28.0",
|
|
51
|
+
"jest": "^29.7.0",
|
|
52
|
+
"prettier": "^3.5.3",
|
|
53
|
+
"rimraf": "^6.0.1",
|
|
54
|
+
"ts-jest": "^29.2.5",
|
|
55
|
+
"typescript": "^5.7.3"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist"
|
|
59
|
+
],
|
|
60
|
+
"exports": {
|
|
61
|
+
".": {
|
|
62
|
+
"import": "./dist/index.js",
|
|
63
|
+
"require": "./dist/index.js",
|
|
64
|
+
"types": "./dist/index.d.ts"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"main": "./dist/index.js",
|
|
68
|
+
"types": "./dist/index.d.ts"
|
|
69
|
+
}
|