@stevederico/skateboard-ui 1.2.12 → 1.2.13

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/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # CHANGELOG
2
+ 1.2.13
3
+
4
+ Fix CSRF localStorage sync
5
+ Fix SignUp form submit
6
+
2
7
  1.2.12
3
8
 
4
9
  Remove unused embla-carousel-react
package/SignInView.jsx CHANGED
@@ -52,7 +52,14 @@ export default function LoginForm({
52
52
 
53
53
  if (response.ok) {
54
54
  const data = await response.json();
55
- // CSRF token is set as cookie by backend, no localStorage needed
55
+ // Save CSRF token from cookie to localStorage for isAuthenticated() check
56
+ const csrfCookie = document.cookie.split('; ').find(row => row.startsWith('csrf_token='));
57
+ if (csrfCookie) {
58
+ const csrfToken = csrfCookie.split('=')[1];
59
+ const appName = constants.appName || 'skateboard';
60
+ const csrfKey = `${appName.toLowerCase().replace(/\s+/g, '-')}_csrf`;
61
+ localStorage.setItem(csrfKey, csrfToken);
62
+ }
56
63
  dispatch({ type: 'SET_USER', payload: data });
57
64
  navigate('/app');
58
65
  } else {
package/SignUpView.jsx CHANGED
@@ -34,7 +34,8 @@ export default function LoginForm({
34
34
  }
35
35
  }, [])
36
36
 
37
- async function signUpClicked() {
37
+ async function signUpClicked(e) {
38
+ e.preventDefault();
38
39
  // Client-side password validation (matches backend: 6-72 chars)
39
40
  if (password.length < 6) {
40
41
  setErrorMessage('Password must be at least 6 characters');
@@ -54,7 +55,14 @@ export default function LoginForm({
54
55
 
55
56
  if (response.ok) {
56
57
  const data = await response.json();
57
- // CSRF token is set as cookie by backend, no localStorage needed
58
+ // Save CSRF token from cookie to localStorage for isAuthenticated() check
59
+ const csrfCookie = document.cookie.split('; ').find(row => row.startsWith('csrf_token='));
60
+ if (csrfCookie) {
61
+ const csrfToken = csrfCookie.split('=')[1];
62
+ const appName = constants.appName || 'skateboard';
63
+ const csrfKey = `${appName.toLowerCase().replace(/\s+/g, '-')}_csrf`;
64
+ localStorage.setItem(csrfKey, csrfToken);
65
+ }
58
66
  dispatch({ type: 'SET_USER', payload: data });
59
67
  navigate('/app');
60
68
  } else {
@@ -82,7 +90,7 @@ export default function LoginForm({
82
90
  </div>
83
91
  )}
84
92
 
85
- <form className="flex flex-col gap-4">
93
+ <form onSubmit={signUpClicked} className="flex flex-col gap-4">
86
94
  <Input
87
95
  ref={nameInputRef}
88
96
  id="name"
@@ -131,7 +139,7 @@ export default function LoginForm({
131
139
  </div>
132
140
 
133
141
  <button
134
- onClick={(e) => { e.preventDefault(); signUpClicked() }}
142
+ type="submit"
135
143
  className="relative group w-full text-white px-8 py-4 rounded-xl font-semibold text-lg transition-all duration-300 shadow-xl backdrop-blur-sm overflow-hidden cursor-pointer"
136
144
  style={{
137
145
  backgroundImage: `linear-gradient(to bottom right,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "1.2.12",
4
+ "version": "1.2.13",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./AppSidebar": {