Skip to content

Add access-code layout and redirect page#474

Open
dmora127 wants to merge 1 commit into
path-cc:masterfrom
dmora127:preview-pearc26-aiml-patch-1
Open

Add access-code layout and redirect page#474
dmora127 wants to merge 1 commit into
path-cc:masterfrom
dmora127:preview-pearc26-aiml-patch-1

Conversation

@dmora127

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a simple “access code required” landing page (via a new Jekyll layout) and a PEARC26 enrollment redirect page that uses that layout to gate navigation to an external registration URL.

Changes:

  • Introduces a new _layouts/access-code.html layout that validates an access code by hashing in the browser and redirecting on match.
  • Adds _redirects/pearc26-enroll.html which configures the access-code layout with a redirect target, prompt text, and expected hash.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
_redirects/pearc26-enroll.html New redirect page configuring the access-code prompt, redirect URL, and stored hash.
_layouts/access-code.html New layout providing the access-code form UI and client-side SHA-256 verification + redirect logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

---
layout: access-code
permalink: /pearc26-enroll.html
redirect_url: hhttps://registry.cilogon.org/registry/co_petitions/start/coef:652
Comment thread _layouts/access-code.html
@@ -0,0 +1,33 @@
<title>{{ page.title | default: "Access Code Required" }}</title>
Comment thread _layouts/access-code.html
Comment on lines +10 to +11
<input id="access-code" type="password" autocomplete="off" autofocus
style="padding: 8px; font-size: 1rem; width: 60%;">
Comment thread _layouts/access-code.html
Comment on lines +14 to +16
<p id="access-error" style="color: #b00020; margin-top: 12px; visibility: hidden;">
Incorrect access code. Please try again.
</p>
Comment thread _layouts/access-code.html
Comment on lines +21 to +32
document.getElementById('access-form').addEventListener('submit', async function (e) {
e.preventDefault();
const code = document.getElementById('access-code').value.trim();
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(code));
const hash = Array.from(new Uint8Array(digest))
.map(b => b.toString(16).padStart(2, '0')).join('');
if (hash === '{{ page.code_hash }}') {
window.location.href = '{{ page.redirect_url }}';
} else {
document.getElementById('access-error').style.visibility = 'visible';
}
});
Comment thread _layouts/access-code.html
Comment on lines +27 to +28
if (hash === '{{ page.code_hash }}') {
window.location.href = '{{ page.redirect_url }}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants