rafmacalaba commited on
Commit
1d1b529
Β·
1 Parent(s): 1626d14

security: gate app behind HF OAuth login

Browse files

Public users see a full-page login screen instead of the annotation tool.
Only ALLOWED_USERS can sign in (checked in OAuth callback).

Files changed (2) hide show
  1. app/globals.css +54 -0
  2. app/page.js +16 -0
app/globals.css CHANGED
@@ -94,6 +94,60 @@ h4 {
94
  background: var(--accent-hover);
95
  }
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  .container {
98
  display: flex;
99
  width: 100%;
 
94
  background: var(--accent-hover);
95
  }
96
 
97
+ /* ── Login Gate ───────────────────────────────── */
98
+
99
+ .login-gate {
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ width: 100%;
104
+ height: 100vh;
105
+ background: var(--bg-color);
106
+ }
107
+
108
+ .login-card {
109
+ text-align: center;
110
+ background: var(--pane-bg);
111
+ border: 1px solid var(--border-color);
112
+ border-radius: 16px;
113
+ padding: 48px 40px;
114
+ max-width: 420px;
115
+ }
116
+
117
+ .login-card h1 {
118
+ font-size: 1.5rem;
119
+ margin: 0 0 12px;
120
+ color: var(--text-color);
121
+ }
122
+
123
+ .login-card p {
124
+ color: #94a3b8;
125
+ font-size: 0.9rem;
126
+ margin: 0 0 24px;
127
+ }
128
+
129
+ .btn-login-large {
130
+ display: inline-block;
131
+ font-size: 1rem;
132
+ font-weight: 700;
133
+ color: #fff;
134
+ background: var(--accent);
135
+ padding: 12px 28px;
136
+ border-radius: 8px;
137
+ text-decoration: none;
138
+ transition: background 0.2s;
139
+ }
140
+
141
+ .btn-login-large:hover {
142
+ background: var(--accent-hover);
143
+ }
144
+
145
+ .login-note {
146
+ font-size: 0.75rem !important;
147
+ color: #64748b !important;
148
+ margin-top: 16px !important;
149
+ }
150
+
151
  .container {
152
  display: flex;
153
  width: 100%;
app/page.js CHANGED
@@ -347,6 +347,22 @@ export default function Home() {
347
  }
348
  };
349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  if (loading) {
351
  return (
352
  <div className="loading-container">
 
347
  }
348
  };
349
 
350
+ // Gate: require HF OAuth login
351
+ if (!annotatorName) {
352
+ return (
353
+ <div className="login-gate">
354
+ <div className="login-card">
355
+ <h1>πŸ”’ Annotation Tool</h1>
356
+ <p>Sign in with your HuggingFace account to access the annotation tool.</p>
357
+ <a href="/api/auth/login" className="btn btn-login-large">
358
+ πŸ€— Sign in with HuggingFace
359
+ </a>
360
+ <p className="login-note">Only authorized annotators can access this tool.</p>
361
+ </div>
362
+ </div>
363
+ );
364
+ }
365
+
366
  if (loading) {
367
  return (
368
  <div className="loading-container">