ASP.NET Core MVC application for user registration, authentication, and management.
- User registration with email confirmation
- Cookie-based authentication
- User management panel (Block, Unblock, Delete)
- PostgreSQL database with unique email index
- Bootstrap 5 responsive UI
- .NET 8.0 SDK
- PostgreSQL database
Important: The repository includes example configuration files (appsettings.example.json and appsettings.Development.example.json). Copy them and fill in your actual values:
cp appsettings.example.json appsettings.json
cp appsettings.Development.example.json appsettings.Development.jsonThen update appsettings.Development.json with your PostgreSQL connection:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=usermanagement;Username=postgres;Password=yourpassword"
}
}For email confirmation, configure Resend API in appsettings.json:
{
"Email": {
"ResendApiKey": "your-resend-api-key",
"FromEmail": "onboarding@resend.dev",
"FromName": "User Management App"
}
}Note: The application uses Resend API instead of SMTP because many hosting providers (like Render) block SMTP ports. Resend API works via HTTPS and doesn't require open SMTP ports.
To get a Resend API key:
- Sign up at resend.com
- Create an API key in your dashboard
- Use the API key in configuration
dotnet ef database updatedotnet runOpen https://localhost:5001 or http://localhost:5000
- Go to Render Dashboard
- New → PostgreSQL
- Copy the "Internal Database URL"
- New → Web Service
- Connect your GitHub repository
- Configure:
- Environment: Docker
- Branch: main
ConnectionStrings__DefaultConnection=<your-postgres-internal-url>
Email__ResendApiKey=<your-resend-api-key>
Email__FromEmail=onboarding@resend.dev
Email__FromName=User Management App
ASPNETCORE_ENVIRONMENT=Production
Important: Use double underscore __ between Email and ResendApiKey in Environment Variables.
Note: The connection string from Render PostgreSQL may be in URL format (postgresql://...). The application automatically converts it to standard Npgsql format if needed.
Render will automatically build and deploy your application.
The application creates a Users table with:
Id(Primary Key)NameEmail(Unique Index - IX_Users_Email_Unique)PasswordHashStatus(Unverified, Active, Blocked)LastLoginTimeRegistrationTimeEmailConfirmationToken
IMPORTANT: Email uniqueness is enforced at the database level via unique index, not application code.
/Controllers
AccountController.cs - Login, Register, Logout, ConfirmEmail
UsersController.cs - User management (Index, Block, Unblock, Delete)
/Filters
CheckUserStatusAttribute.cs - Checks user status before each request
/Services
EmailService.cs - Sends confirmation emails via Resend API
IEmailService.cs - Email service interface
/Models
User.cs - User entity
ViewModels/ - Login and Register view models
/Views
Account/ - Login and Register forms
Users/ - User management table
- ✅ Unique index on Email (database-level)
- ✅ Table with toolbar (no row buttons)
- ✅ Sorted by LastLoginTime (default), with column sorting support
- ✅ Checkbox selection with Select All
- ✅ User status check before each request (single filter)
- ✅ Bootstrap CSS framework
- ✅ Email confirmation (async via Resend API)
- ✅ Any non-empty password accepted
- ✅ Real-time client-side filtering by Name and Email
- ✅ Blocked users styling (grayed out, struck through)
- ✅ Delete unverified users functionality
The application is deployed on Render:
- URL: https://user-management-app-je14.onrender.com
- Database: PostgreSQL on Render
- Email Service: Resend API
- Backend: ASP.NET Core 8.0 MVC
- Database: PostgreSQL with Entity Framework Core
- Authentication: Cookie-based authentication
- Email: Resend API (REST API, works on Render)
- Frontend: Razor Views with Bootstrap 5
- Password Hashing: BCrypt.Net-Next