create-prisma-php-app 4.0.0-alpha.24 → 4.0.0-alpha.25

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/dist/index.js CHANGED
@@ -164,7 +164,7 @@ const composerPinnedVersions = {
164
164
  "brick/math": "^0.13.1",
165
165
  "cboden/ratchet": "^0.4.4",
166
166
  "tsnc/prisma-php": "^1.0.0",
167
- "php-mcp/server": "3.3",
167
+ "php-mcp/server": "3.3.0",
168
168
  };
169
169
  function composerPkg(name) {
170
170
  return composerPinnedVersions[name]
@@ -12,6 +12,9 @@ final class AuthMiddleware
12
12
  {
13
13
  public static function handle($requestPathname)
14
14
  {
15
+ $singInRoute = "/signin";
16
+ $deniedRoute = "/denied";
17
+
15
18
  if (AuthConfig::IS_ALL_ROUTES_PRIVATE) {
16
19
  $isLogin = Auth::getInstance()->isAuthenticated();
17
20
  $isApiAuthRoute = stripos($requestPathname, AuthConfig::API_AUTH_PREFIX) === 0;
@@ -42,7 +45,7 @@ final class AuthMiddleware
42
45
 
43
46
  // Redirect to the default home route if the user is already authenticated
44
47
  if (!$isLogin && !$isPublicRoute) {
45
- Request::redirect("/signin");
48
+ Request::redirect($singInRoute);
46
49
  }
47
50
  } else {
48
51
  // Skip the middleware if the route is public
@@ -52,7 +55,7 @@ final class AuthMiddleware
52
55
 
53
56
  // Check if the user is authorized to access the route or redirect to login
54
57
  if (!self::isAuthorized()) {
55
- Request::redirect('/signin');
58
+ Request::redirect($singInRoute);
56
59
  }
57
60
  }
58
61
 
@@ -65,7 +68,7 @@ final class AuthMiddleware
65
68
  // echo "You are authorized to access this route";
66
69
  } elseif ($matchValue === "Role mismatch") {
67
70
  // echo "You are not authorized to access this route";
68
- Request::redirect('/denied');
71
+ Request::redirect($deniedRoute);
69
72
  } else {
70
73
  // echo "Unexpected error encountered";
71
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.0.0-alpha.24",
3
+ "version": "4.0.0-alpha.25",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",