miolo 3.0.0-beta.201 → 3.0.0-beta.202

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": "miolo",
3
- "version": "3.0.0-beta.201",
3
+ "version": "3.0.0-beta.202",
4
4
  "description": "all-in-one koa-based server",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -390,7 +390,7 @@ export default function make_config_defaults() {
390
390
  // err => done(error, null)
391
391
  // local_url_login : '/login',
392
392
  // local_url_logout: '/logout',
393
- // local_url_login_redirect: undefined
393
+ // local_url_login_redirect: '/
394
394
  // local_url_logout_redirect: '/'
395
395
  // google_auth_user: (accessToken, refreshToken, profile, done, ctx) => done(null, {id: 1})
396
396
  // auth => done(null, user)
@@ -247,9 +247,18 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
247
247
  }
248
248
 
249
249
  // handle auth routes
250
- const handleGoogleLogin = passport.authenticate("google", {
251
- scope: ["profile", "email"]
252
- })
250
+ const handleGoogleLogin = (ctx, next) => {
251
+ ctx.miolo.logger.debug(`[auth][google] handleGoogleLogin() - authenticating...`)
252
+
253
+ const redirectUrl = ctx.query.redirect || "/"
254
+
255
+ const strategy = passport.authenticate("google", {
256
+ scope: ["profile", "email"],
257
+ state: redirectUrl
258
+ })
259
+
260
+ return strategy(ctx, next)
261
+ }
253
262
 
254
263
  const handleGoogleCallback = (ctx, next) => {
255
264
  ctx.miolo.logger.debug(`[auth][google] handleGoogleCallback() - authenticating...`)
@@ -295,9 +304,8 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
295
304
  }
296
305
  }
297
306
 
298
- if (google_url_login_redirect !== undefined) {
299
- ctx.redirect(google_url_login_redirect)
300
- }
307
+ const redirectUrl = ctx.query.state || google_url_login_redirect || "/"
308
+ ctx.redirect(redirectUrl)
301
309
  }
302
310
  })(ctx, next)
303
311
  }
@@ -45,9 +45,9 @@
45
45
  "intre": "^3.0.0-beta.4",
46
46
  "joi": "^18.2.1",
47
47
  "lucide-react": "^1.16.0",
48
- "miolo-cli": "^3.0.0-beta.201",
48
+ "miolo-cli": "^3.0.0-beta.202",
49
49
  "miolo-model": "file:../miolo-model",
50
- "miolo-react": "^3.0.0-beta.201",
50
+ "miolo-react": "^3.0.0-beta.202",
51
51
  "next-themes": "^0.4.6",
52
52
  "radix-ui": "^1.4.3",
53
53
  "react": "^19.2.6",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@biomejs/biome": "2.4.15",
65
- "miolo": "^3.0.0-beta.201",
65
+ "miolo": "^3.0.0-beta.202",
66
66
  "sass-embedded": "^1.99.0"
67
67
  },
68
68
  "overrides": {