Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Copy this file to `.env` and fill in the values. Do NOT commit your real secrets.

# --- Identity Vault (required) ---
# Base URL of Identity Vault API (production or staging)
IDENTITY_URL="https://identity.hackclub.com"
# Base URL of Hack Club Account API (production or staging)
IDENTITY_URL="https://account.hackclub.com"
# OAuth client credentials for this app (obtain from Identity Vault)
IDENTITY_CLIENT_ID="your_client_id"
IDENTITY_CLIENT_SECRET="your_client_secret"
Expand Down
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hack Club Submit – Copilot instructions
## Overview
- Rails 7.1 app that mirrors the old Next.js Submit flow; root landing is `ProgramsController#show` keyed by slug (`/:program`) and everything pivots around OAuth with Hack Club Identity.
- Rails 7.1 app that mirrors the old Next.js Submit flow; root landing is `ProgramsController#show` keyed by slug (`/:program`) and everything pivots around OAuth with Hack Club Account.
- Primary controllers: `app/controllers/identity_controller.rb` (browser OAuth), `app/controllers/api/verify_controller.rb` (server-side verification), and `app/controllers/popup/authorize_controller.rb` (partner popup flow).
- Reuse the helpers in `UserJourneyFlow` and `StateToken`; they already encode/validate OAuth state and map identity data onto third-party form URLs.

Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- **Database**: `bin/rails db:prepare` (setup), `bin/rails db:seed` (seed with superadmin)

## Architecture
- **Rails 7.1** app centered on OAuth with Hack Club Identity; entry point is `ProgramsController#show` (route: `/:program`)
- **Rails 7.1** app centered on OAuth with Hack Club Account; entry point is `ProgramsController#show` (route: `/:program`)
- **Core controllers**: `IdentityController` (browser OAuth), `Api::VerifyController` (server verification), `Popup::AuthorizeController` (partner popup flow), `Admin::SessionsController` (admin login)
- **Key models**: `Program` (stores theming, scopes, mappings), `AuthorizedSubmitToken` (submit tokens), `AuthorizationRequest` (popup flow), `VerificationAttempt` (audit log), `AdminUser`, `UserJourneyEvent`
- **Services**: `StateToken` (OAuth state generation/validation), `IdentityNormalizer` (normalize identity payloads), `UserJourneyFlow` (journey helpers)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hack Club Submit

A lightweight Rails app that powers Hack Club's Submit flow. It handles OAuth with Hack Club Identity, issues short-lived tokens, and lets YSWS sites pre-fill forms with verified Identity Vault info.
A lightweight Rails app that powers Hack Club's Submit flow. It handles OAuth with Hack Club Account, issues short-lived tokens, and lets YSWS sites pre-fill forms with verified Identity Vault info.

## What you get

Expand Down Expand Up @@ -35,7 +35,7 @@ Set these environment variables (shell, `.env`, or your process manager):
## How the flow works

1. Program pages seed a `submit_id` and log the visit.
2. Identity endpoints build OAuth state with `StateToken` and redirect to Hack Club Identity.
2. Identity endpoints build OAuth state with `StateToken` and redirect to Hack Club Account.
3. The callback fetches and normalizes identity via `IdentityNormalizer`, then redirects or issues a token.
4. Partners call `POST /api/verify` with that token to validate the submission.

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def index

if user_data['verification_status'] != 'verified' || user_data['rejection_reason'].present?
message = if user_data['rejection_reason'].present?
'Your submission was rejected. Visit identity.hackclub.com for more info.'
'Your submission was rejected. Visit account.hackclub.com for more info.'
elsif user_data['verification_status'] == 'pending'
'Your identity verification is pending. Please wait for approval.'
else
"We couldn't find an approved verification yet. Check identity.hackclub.com for more information."
"We couldn't find an approved verification yet. Check account.hackclub.com for more information."
end

attempt = create_attempt_safely!(
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/identity_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def callback
if user_data['rejection_reason']
return oauth_fail(
reason: 'rejected',
alert_message: 'Your submission got rejected! Go to identity.hackclub.com for more info.',
alert_message: 'Your submission got rejected! Go to account.hackclub.com for more info.',
program: state_data['program'],
idv_rec: user_data['id'].to_s,
email: user_data['email'],
Expand All @@ -196,7 +196,7 @@ def callback
unless user_data['verification_status'] == 'verified'
return oauth_fail(
reason: 'missing_approved_verification',
alert_message: "We couldn't find an approved verification yet. Visit identity.hackclub.com for more information.",
alert_message: "We couldn't find an approved verification yet. Visit account.hackclub.com for more information.",
program: state_data['program'],
idv_rec: user_data['id'].to_s,
email: user_data['email'],
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/popup/authorize_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def callback
when 'pending'
'Your identity verification is pending. Please wait for approval.'
when 'rejected'
'Your submission was rejected. Visit identity.hackclub.com for more info.'
'Your submission was rejected. Visit account.hackclub.com for more info.'
else
"We couldn't find an approved verification yet. Visit identity.hackclub.com for more information."
"We couldn't find an approved verification yet. Visit account.hackclub.com for more information."
end
return render :error, locals: { message: message }, layout: 'application'
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<section class="flex flex-col items-center space-y-4">
<h1 class="text-2xl">Hack Club Submit</h1>
<h2 class="text-3xl md:text-5xl font-bold">Secure identity verification for YSWS</h2>
<p class="text-lg text-default-questions/60">A modern, secure flow for YSWS project submissions.<br>Powered by Hack Club Identity.</p>
<p class="text-lg text-default-questions/60">A modern, secure flow for YSWS project submissions.<br>Powered by Hack Club Account.</p>
</section>
<section class="bg-neutral-800 p-4 md:p-8 rounded border-t-4 border-default-primary space-y-4" style="max-width:640px;">
<h3 class="text-2xl font-bold">How this works</h3>
<ol class="space-y-2 text-lg">
<li><strong>1.</strong> Submit to a supported YSWS through their site</li>
<li><strong>2.</strong> Securely verify via <a class="underline" href="https://identity.hackclub.com">Hack Club Identity</a></li>
<li><strong>2.</strong> Securely verify via <a class="underline" href="https://account.hackclub.com">Hack Club Account</a></li>
<li><strong>3.</strong> See what gets shared to the YSWS</li>
<li><strong>4.</strong> Automatically return to continue your submission</li>
</ol>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</div>
</main>
<footer class="flex items-center justify-center py-2 md:py-4 text-xs text-default-questions/40 md:text-default-questions/50 mx-2 md:mx-8 w-full">
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://identity.hackclub.com" class="underline">Hack Club Identity</a>.</p>
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://account.hackclub.com" class="underline">Hack Club Account</a>.</p>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
</main>
<footer class="flex items-center justify-center py-4 text-xs text-default-questions/50 mx-8">
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://identity.hackclub.com" class="underline">Hack Club Identity</a>.</p>
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://account.hackclub.com" class="underline">Hack Club Account</a>.</p>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion app/views/layouts/program.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<%= yield %>
</main>
<footer class="flex items-center justify-center py-4 text-xs px-2 sm:px-8 bg-neutral-800 sm:bg-transparent <%= defined?(@program) ? (@program&.is_bg_secondary_dark? ? 'text-neutral-500' : 'text-neutral-900') : 'text-neutral-500' %>">
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://identity.hackclub.com" class="underline">Hack Club Identity</a>.</p>
<p>Made with <span class="text-pink-400" aria-hidden="true">❤</span> by Leo from <a href="https://hackclub.com" class="underline">Hack Club</a>. Powered by <a href="https://account.hackclub.com" class="underline">Hack Club Account</a>.</p>
</footer>
</body>
</html>