[PR #23] [MERGED] feat: Add bulk import from ISEN excel #81

Closed
opened 2026-05-06 12:18:37 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/BreizhHardware/Site-comptage-heure/pull/23
Author: @BreizhHardware
Created: 11/20/2025
Status: Merged
Merged: 11/20/2025
Merged by: @BreizhHardware

Base: devHead: feat/bulk-import


📝 Commits (1)

  • eb8132b feat: Add bulk import from ISEN excel

📊 Changes

15 files changed (+1398 additions, -2018 deletions)

View changed files

📝 README.md (+2 -2)
app/admin/import-users/page.tsx (+213 -0)
📝 app/admin/page.tsx (+6 -1)
app/api/change-password/route.ts (+35 -0)
app/api/import-users/route.ts (+170 -0)
app/change-password/page.tsx (+117 -0)
📝 components/providers.tsx (+26 -2)
📝 lib/auth.ts (+9 -1)
📝 package.json (+2 -1)
📝 pnpm-lock.yaml (+747 -2011)
prisma/migrations/20251120162836_add_password_reset_required/migration.sql (+33 -0)
prisma/migrations/migration_lock.toml (+3 -0)
📝 prisma/schema.prisma (+2 -0)
scripts/fix-imported-passwords.js (+30 -0)
📝 types/next-auth.d.ts (+3 -0)

📄 Description

This pull request introduces a comprehensive user import workflow from Excel files, enforces password reset for newly imported users, and adds backend and frontend support for password changes. It also improves session management to ensure users with temporary passwords are redirected to change their password before accessing the app. Additional minor improvements include dependency updates and documentation tweaks.

User Import Feature:

  • Implements a new admin UI (app/admin/import-users/page.tsx) for uploading and parsing Excel files, previewing users to be imported, handling errors, and confirming import actions.
  • Adds backend API endpoints (app/api/import-users/route.ts) for parsing Excel files, validating user data, and batch creating users with temporary passwords and passwordResetRequired set to true.
  • Updates the admin dashboard (app/admin/page.tsx) to include a button linking to the new import users page.

Password Reset Enforcement:

  • Adds a passwordResetRequired boolean field to the User model in the database schema and migration.
  • Modifies authentication/session logic (lib/auth.ts) to propagate passwordResetRequired through JWT tokens and session objects, supporting session updates after password changes. [1] [2]
  • Introduces a PasswordResetGuard in the global providers (components/providers.tsx) to redirect users with a temporary password to the password change page.

Password Change Flow:

  • Implements a dedicated password change page (app/change-password/page.tsx) that enforces password requirements and updates the session state after a successful change.
  • Adds an API endpoint (app/api/change-password/route.ts) to securely update the user's password and clear the passwordResetRequired flag.

Other Improvements:

  • Updates the documentation to use pnpx instead of npx for Prisma commands.
  • Adds the rimraf package to package.json and pins the Prisma version for improved dependency management.

Closes #22


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BreizhHardware/Site-comptage-heure/pull/23 **Author:** [@BreizhHardware](https://github.com/BreizhHardware) **Created:** 11/20/2025 **Status:** ✅ Merged **Merged:** 11/20/2025 **Merged by:** [@BreizhHardware](https://github.com/BreizhHardware) **Base:** `dev` ← **Head:** `feat/bulk-import` --- ### 📝 Commits (1) - [`eb8132b`](https://github.com/BreizhHardware/Site-comptage-heure/commit/eb8132b20f57c7ccec3fc76cf691c182d1e9106f) feat: Add bulk import from ISEN excel ### 📊 Changes **15 files changed** (+1398 additions, -2018 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -2) ➕ `app/admin/import-users/page.tsx` (+213 -0) 📝 `app/admin/page.tsx` (+6 -1) ➕ `app/api/change-password/route.ts` (+35 -0) ➕ `app/api/import-users/route.ts` (+170 -0) ➕ `app/change-password/page.tsx` (+117 -0) 📝 `components/providers.tsx` (+26 -2) 📝 `lib/auth.ts` (+9 -1) 📝 `package.json` (+2 -1) 📝 `pnpm-lock.yaml` (+747 -2011) ➕ `prisma/migrations/20251120162836_add_password_reset_required/migration.sql` (+33 -0) ➕ `prisma/migrations/migration_lock.toml` (+3 -0) 📝 `prisma/schema.prisma` (+2 -0) ➕ `scripts/fix-imported-passwords.js` (+30 -0) 📝 `types/next-auth.d.ts` (+3 -0) </details> ### 📄 Description This pull request introduces a comprehensive user import workflow from Excel files, enforces password reset for newly imported users, and adds backend and frontend support for password changes. It also improves session management to ensure users with temporary passwords are redirected to change their password before accessing the app. Additional minor improvements include dependency updates and documentation tweaks. **User Import Feature:** - Implements a new admin UI (`app/admin/import-users/page.tsx`) for uploading and parsing Excel files, previewing users to be imported, handling errors, and confirming import actions. - Adds backend API endpoints (`app/api/import-users/route.ts`) for parsing Excel files, validating user data, and batch creating users with temporary passwords and `passwordResetRequired` set to `true`. - Updates the admin dashboard (`app/admin/page.tsx`) to include a button linking to the new import users page. **Password Reset Enforcement:** - Adds a `passwordResetRequired` boolean field to the `User` model in the database schema and migration. - Modifies authentication/session logic (`lib/auth.ts`) to propagate `passwordResetRequired` through JWT tokens and session objects, supporting session updates after password changes. [[1]](diffhunk://#diff-cd41b427b38a554f9a1a2d2e848e41ddc39bc7d68dba54c1398d7384d6aaf4f7R35) [[2]](diffhunk://#diff-cd41b427b38a554f9a1a2d2e848e41ddc39bc7d68dba54c1398d7384d6aaf4f7L43-R60) - Introduces a `PasswordResetGuard` in the global providers (`components/providers.tsx`) to redirect users with a temporary password to the password change page. **Password Change Flow:** - Implements a dedicated password change page (`app/change-password/page.tsx`) that enforces password requirements and updates the session state after a successful change. - Adds an API endpoint (`app/api/change-password/route.ts`) to securely update the user's password and clear the `passwordResetRequired` flag. **Other Improvements:** - Updates the documentation to use `pnpx` instead of `npx` for Prisma commands. - Adds the `rimraf` package to `package.json` and pins the Prisma version for improved dependency management. Closes #22 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:18:37 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BreizhHardware/Site-comptage-heure#81
No description provided.