miolo 3.0.0-beta.201 → 3.0.0-beta.203
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
package/src/config/defaults.mjs
CHANGED
|
@@ -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:
|
|
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,22 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// handle auth routes
|
|
250
|
-
const handleGoogleLogin =
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
const handleGoogleLogin = (ctx, next) => {
|
|
251
|
+
ctx.miolo.logger.debug(`[auth][google] handleGoogleLogin() - authenticating...`)
|
|
252
|
+
|
|
253
|
+
const redirectUrl = ctx.query.redirect || "/"
|
|
254
|
+
|
|
255
|
+
ctx.miolo.logger.info(
|
|
256
|
+
`[auth][google] handleGoogleLogin() - authenticating with redirectUrl: ${redirectUrl}`
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
const strategy = passport.authenticate("google", {
|
|
260
|
+
scope: ["profile", "email"],
|
|
261
|
+
state: redirectUrl
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
return strategy(ctx, next)
|
|
265
|
+
}
|
|
253
266
|
|
|
254
267
|
const handleGoogleCallback = (ctx, next) => {
|
|
255
268
|
ctx.miolo.logger.debug(`[auth][google] handleGoogleCallback() - authenticating...`)
|
|
@@ -284,20 +297,24 @@ const init_passport_auth_middleware = (app, options, sessionConfig, cacheConfig)
|
|
|
284
297
|
ctx.session.authenticated = true
|
|
285
298
|
ctx.session.auth_method = "google"
|
|
286
299
|
|
|
287
|
-
ctx.body = {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
300
|
+
// ctx.body = {
|
|
301
|
+
// ok: true,
|
|
302
|
+
// data: {
|
|
303
|
+
// user: user,
|
|
304
|
+
// authenticated: true,
|
|
305
|
+
// config: {
|
|
306
|
+
// auth_method: "google"
|
|
307
|
+
// }
|
|
308
|
+
// }
|
|
309
|
+
// }
|
|
297
310
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
311
|
+
const redirectUrl = ctx.query.state || google_url_login_redirect || "/"
|
|
312
|
+
|
|
313
|
+
ctx.miolo.logger.info(
|
|
314
|
+
`[auth][google] handleGoogleCallback() - redirecting to: ${redirectUrl}. query.state: ${ctx.query.state}. google_url_login_redirect: ${google_url_login_redirect}`
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
ctx.redirect(redirectUrl)
|
|
301
318
|
}
|
|
302
319
|
})(ctx, next)
|
|
303
320
|
}
|
package/template/package.json
CHANGED
|
@@ -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.
|
|
48
|
+
"miolo-cli": "^3.0.0-beta.203",
|
|
49
49
|
"miolo-model": "file:../miolo-model",
|
|
50
|
-
"miolo-react": "^3.0.0-beta.
|
|
50
|
+
"miolo-react": "^3.0.0-beta.203",
|
|
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.
|
|
65
|
+
"miolo": "^3.0.0-beta.203",
|
|
66
66
|
"sass-embedded": "^1.99.0"
|
|
67
67
|
},
|
|
68
68
|
"overrides": {
|