EmailController Class
The EmailController
class handles email-related actions such as account activation and password resets.
Key Features
- Account Activation: Verifies email addresses and activates user accounts.
- Password Reset: Generates and sends new passwords to users who have forgotten theirs.
Components
- VolatileTokenManager: Manages temporary tokens for email verification and password reset processes.
- Hasher: Used for hashing passwords.
- EmailSender: Handles the sending of all email communications.
- PasswordGenerator: Generates secure passwords for account recovery.
Endpoints
GET /activate
: Activates a user account using a verification code sent via email. Displays a confirmation page upon successful verification.GET /reset-password
: Resets the user's password and sends a new one via email. Provides feedback through a web page confirming the password reset.
Swagger Documentation
You can also check out the endpoints here: accounts.bytecobra.com.
HTML Content
The controller delivers HTML responses for account activation and password reset confirmations, providing a straightforward and accessible experience directly in a web browser upon clicking an email link.
For customization, subclass the EmailController and override EmailVerifiedHtmlContent or PasswordResetHtmlContent to tailor the HTML content to your needs.
Rate Limiting
Both the activation and password reset endpoints are rate-limited to prevent abuse, ensuring the system remains reliable and secure for all users.
Usage
This controller is automatically wired up through ASP.NET Core's MVC framework and listens for HTTP requests matching its routes. It's accessible through standard HTTP client tools or libraries from front-end applications.
For custom functionality, you have the option to extend and customize this controller through subclassing.