mbkauthe 4.1.1 → 4.1.2
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/lib/middleware/auth.js
CHANGED
|
@@ -6,18 +6,13 @@ import { clearSessionCookies, cachedCookieOptions, readAccountListFromCookie } f
|
|
|
6
6
|
async function validateSession(req, res, next) {
|
|
7
7
|
if (!req.session.user) {
|
|
8
8
|
console.log("[mbkauthe] User not authenticated");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const pageTarget = hasRemembered ? '/mbkauthe/accounts' : `/mbkauthe/login?redirect=${encodeURIComponent(req.originalUrl)}`;
|
|
12
|
-
const message = hasRemembered
|
|
13
|
-
? "Another saved account is available. Open the switch page to continue."
|
|
14
|
-
: "You Are Not Logged In. Please Log In To Continue.";
|
|
15
|
-
return renderError(res, req, {
|
|
9
|
+
console.log("[mbkauthe]: ", req.session.user);
|
|
10
|
+
return renderError(res, {
|
|
16
11
|
code: 401,
|
|
17
12
|
error: "Not Logged In",
|
|
18
|
-
message,
|
|
19
|
-
pagename:
|
|
20
|
-
page:
|
|
13
|
+
message: "You Are Not Logged In. Please Log In To Continue.",
|
|
14
|
+
pagename: "Login",
|
|
15
|
+
page: `/mbkauthe/login?redirect=${encodeURIComponent(req.originalUrl)}`,
|
|
21
16
|
});
|
|
22
17
|
}
|
|
23
18
|
|
package/package.json
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
<i class="fab fa-github"></i>
|
|
30
30
|
<span>Continue with GitHub</span>
|
|
31
31
|
</a>
|
|
32
|
-
{{/if
|
|
32
|
+
{{/if}}
|
|
33
33
|
{{#if googleLoginEnabled }}
|
|
34
34
|
<a type="button" id="googleLoginBtn" class="btn-social btn-google-side">
|
|
35
35
|
<i class="fab fa-google"></i>
|
|
36
36
|
<span>Continue with Google</span>
|
|
37
37
|
</a>
|
|
38
|
-
{{/if
|
|
38
|
+
{{/if}}
|
|
39
39
|
<a href="/mbkauthe/accounts" id="switchacc" class="btn-social btn-switch-side">
|
|
40
40
|
<i class="fa fa-user-group"></i>
|
|
41
41
|
<span>Switch Account</span>
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
<a class="terms-link" href="/mbkauthe/accounts">switch account</a>.
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
71
|
-
{{/if
|
|
71
|
+
{{/if}}
|
|
72
72
|
<input type="hidden" name="_csrf" value="{{csrfToken}}">
|
|
73
73
|
<div class="form-group">
|
|
74
74
|
<input id="loginUsername" class="form-input" type="text" name="username" placeholder=" "
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
314
|
|
|
315
|
-
{
|
|
315
|
+
{{#if githubLoginEnabled }}
|
|
316
316
|
|
|
317
317
|
// GitHub login: Navigate directly to GitHub OAuth flow
|
|
318
318
|
async function startGithubLogin() {
|
|
@@ -328,9 +328,9 @@
|
|
|
328
328
|
const mobileGithubBtn = document.querySelector('.mobile-github-btn');
|
|
329
329
|
if (githubBtn) githubBtn.addEventListener('click', startGithubLogin);
|
|
330
330
|
if (mobileGithubBtn) mobileGithubBtn.addEventListener('click', startGithubLogin);
|
|
331
|
-
{
|
|
331
|
+
{{/if}}
|
|
332
332
|
|
|
333
|
-
{
|
|
333
|
+
{{#if googleLoginEnabled }}
|
|
334
334
|
|
|
335
335
|
// Google login: Navigate directly to Google OAuth flow
|
|
336
336
|
async function startGoogleLogin() {
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
const mobileGoogleBtn = document.querySelector('.mobile-google-btn');
|
|
347
347
|
if (googleBtn) googleBtn.addEventListener('click', startGoogleLogin);
|
|
348
348
|
if (mobileGoogleBtn) mobileGoogleBtn.addEventListener('click', startGoogleLogin);
|
|
349
|
-
{
|
|
349
|
+
{{/if}}
|
|
350
350
|
</script>
|
|
351
351
|
</body>
|
|
352
352
|
|