@stevederico/skateboard-ui 0.7.1 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ 0.7.3
4
+ auth improvements
5
+
3
6
  0.7.1
4
7
 
5
8
  Fix import paths
package/SignInView.jsx CHANGED
@@ -53,7 +53,9 @@ export default function LoginForm({
53
53
 
54
54
  if (response.ok) {
55
55
  const data = await response.json();
56
- document.cookie = `token=${data.token}; path=/; Secure; SameSite=Strict; expires=${new Date(data.tokenExpires * 1000).toUTCString()}`;
56
+ const appName = constants.appName || 'skateboard';
57
+ const cookieName = `${appName.toLowerCase().replace(/\s+/g, '-')}_token`;
58
+ document.cookie = `${cookieName}=${data.token}; path=/; Secure; SameSite=Strict; expires=${new Date(data.tokenExpires * 1000).toUTCString()}`;
57
59
  delete data.token;
58
60
  dispatch({ type: 'SET_USER', payload: data });
59
61
  navigate('/app');
package/SignUpView.jsx CHANGED
@@ -50,8 +50,10 @@ export default function LoginForm({
50
50
  const expireDate = new Date();
51
51
  expireDate.setTime(expireDate.getTime() + 24 * 60 * 60 * 1000);
52
52
  const tokenValue = encodeURIComponent(data.token);
53
- const hostname = window.location.hostname;
54
- document.cookie = `token=${tokenValue}; path=/; domain=${hostname}; expires=${expireDate.toUTCString()}`;
53
+ const hostname = window.location.hostname;
54
+ const appName = constants.appName || 'skateboard';
55
+ const cookieName = `${appName.toLowerCase().replace(/\s+/g, '-')}_token`;
56
+ document.cookie = `${cookieName}=${tokenValue}; path=/; domain=${hostname}; expires=${expireDate.toUTCString()}`;
55
57
 
56
58
  delete data.token
57
59
  dispatch({ type: 'SET_USER', payload: data });
package/Utilities.js CHANGED
@@ -1,8 +1,15 @@
1
1
  import constants from "@/constants.json";
2
2
 
3
3
  export function getCookie(name) {
4
+ // For token cookies, use app-specific name
5
+ let cookieName = name;
6
+ if (name === 'token') {
7
+ const appName = constants.appName || 'skateboard';
8
+ cookieName = `${appName.toLowerCase().replace(/\s+/g, '-')}_token`;
9
+ }
10
+
4
11
  const value = `; ${document.cookie}`;
5
- const parts = value.split(`; ${name}=`);
12
+ const parts = value.split(`; ${cookieName}=`);
6
13
  if (parts.length === 2) return parts.pop().split(';').shift();
7
14
  return null;
8
15
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "0.7.1",
4
+ "version": "0.7.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./AppSidebar": {
@@ -1,9 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(git add:*)",
5
- "Bash(git commit:*)"
6
- ],
7
- "deny": []
8
- }
9
- }