Create a seprate login page for admin and the credentials should not be visible here but here in the chat you give the credentials
Credentials (set these in your project’s Environment Variables, not in code):
Summary: I added a secure admin login at /admin/login that checks credentials on the server via environment variables and sets a httpOnly session cookie, plus a protected /admin dashboard with a logout action. No credentials are exposed in the UI or code; please add ADMIN_EMAIL and ADMIN_PASSWORD in the v0 Environment Variables UI, then publish or preview.
To configure the generation, complete these steps:
An error occurred during deployment. Please fix:
Please add source code to this block
Admin credentials to add as environment variables (do not put these in code):
Summary: I added a secure admin login at /admin/login with a server action validating against env vars, issuing a signed httpOnly cookie, and a protected /admin page that verifies the token and redirects if unauthenticated. There’s also a logout action that clears the cookie. Add the env vars above in the v0 Environment Variables UI, then preview or publish.
Reminder: Always read a file before writing or editing it to avoid overwriting important code. I’ll read the target files now and then add the necessary implementations.
Credentials (set in Environment Variables, not in code):
Summary: I added a small auth utility to sign/verify admin sessions and updated the login and dashboard to use a signed, httpOnly cookie. Credentials remain in environment variables and aren’t exposed in code or the UI.
To configure the generation, complete these steps:
An error occurred during deployment. Please fix:
Running build in Washington, D.C., USA (East) – iad1
Build machine configuration: 2 cores, 8 GB
Retrieving list of deployment files...
Downloading 75 deployment files...
Restored build cache from previous deployment (4U8jtGFWScb6ELBpTQL3M7hFrJfk)
Running "vercel build"
Vercel CLI 48.1.1
Running "install" command: `bun install`...
bun install v1.2.22 (6bafe260)
+ @vercel/analytics@1.3.1
+ crypto@1.0.1
3 packages installed [125.00ms]
Detected Next.js version: 14.2.16
Running "bun run build"
$ next build
▲ Next.js 14.2.16
Creating an optimized production build ...
⚠ Compiled with warnings
./components/admin-login-form.tsx
Attempted import error: 'useActionState' is not exported from 'react' (imported as 'useActionState').
Import trace for requested module:
./components/admin-login-form.tsx
✓ Compiled successfully
Skipping validation of types
Skipping linting
Collecting page data ...
Generating static pages (0/5) ...
Generating static pages (1/5)
Generating static pages (2/5)
Generating static pages (3/5)
TypeError: (0 , i.useActionState) is not a function or its return value is not iterable
at ew (/vercel/path1/.next/server/app/admin/login/page.js:1:28635)
at nj (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:46251)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47571)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560)
at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560) {
digest: '403848748'
}
Error occurred prerendering page "/admin/login". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: (0 , i.useActionState) is not a function or its return value is not iterable
at ew (/vercel/path1/.next/server/app/admin/login/page.js:1:28635)
at nj (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:46251)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47571)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560)
at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560)
✓ Generating static pages (5/5)
> Export encountered errors on following paths:
/admin/login/page: /admin/login
error: script "build" exited with code 1
Error: Command "bun run build" exited with 1