Skip to content

Authentication & User Registration Enhancements#31

Open
shreyashsri79 wants to merge 5 commits into
FOSSEE:developfrom
shreyashsri79:develop
Open

Authentication & User Registration Enhancements#31
shreyashsri79 wants to merge 5 commits into
FOSSEE:developfrom
shreyashsri79:develop

Conversation

@shreyashsri79

Copy link
Copy Markdown

Fix: Authentication & User Registration Enhancements + Restored .ENV

Summary

This pull request introduces critical stability fixes for the authentication system, implements a robust pending user registration approval workflow, and adds an administrative dashboard for user account management. It also ensures that local development environments can proceed with registration flows even when SMTP/email services are not configured.


Detailed Changes

1. Stability & Null-Safety (Frontend)

  • Logout Crash Fix: Resolved a runtime crash (TypeError: can't access property "username", auth.user is null) that occurred on logout or when visiting pages in an unauthenticated state.
  • Component Safeguards:
    • Updated SchematicsList.js to access auth.user properties via optional chaining (auth.user?.username).
    • Updated DashboardOtherProjects.js with similar null-safe optional chaining.

2. Developer-Friendly OTP Fallback Flow (Frontend & Backend)

  • OTP Response Payload: If local SMTP settings (EMAIL_HOST_USER and EMAIL_HOST_PASSWORD in .env) are left at default placeholder values, the backend API (CustomUserCreateView in esim-cloud-backend/authAPI/views.py) will automatically embed the generated activation token directly in the HTTP 201 Created response.
  • OTP Modal / Alert: Updated authActions.js to detect the presence of this token and display it to the user via a browser alert, allowing registrations to be completed in environments without outgoing mail support.

3. Pending User Approval System & DB Schema (Backend)

  • PendingUser Model: Created a new database model to hold details of users waiting for admin approval before activation.
  • Database Migration: Ran Django migrations to create the authAPI_pendinguser table.
  • Admin Dashboard UI: Created account_dashboard.html and mapped it to /api/auth/dashboard/ to serve as a control panel for administrators to review, approve, and manage user accounts.

4. Admin Dashboard Access (Frontend Integration)

  • Added an "Admin Dashboard" button option inside the user dropdown menus of:
    • The main dashboard header: Navbar.js
    • The schematic editor header: Header.js

Verification & Testing Steps

Step 1: Run Migrations

Ensure database tables are up to date:

docker exec -it esim-cloud-django-1 python manage.py migrate

Step 2: Test User Registration

  1. Navigate to the signup page.
  2. Sign up with a new email and password.
  3. If mail services are offline/unconfigured, confirm that the activation OTP is displayed in a browser alert.
  4. Input the code to activate the user.

Step 3: Admin Dashboard Navigation

  1. Log in.
  2. Open the user dropdown menu in the navbar or editor header.
  3. Click Admin Dashboard and verify you are navigated to /api/auth/dashboard/.

Step 4: Verify Logout Stability

  1. Log out of the account.
  2. Confirm that the dashboard successfully updates without rendering any crashes related to auth.user.

…d resolve edit details description validation bug
# Conflicts:
#	eda-frontend/src/App.js
#	eda-frontend/src/components/Dashboard/DashboardHome.js
#	eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
#	eda-frontend/src/components/Shared/Layout.js
#	eda-frontend/src/pages/Dashboard.js
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.

1 participant