✨ Introduction
In a real-world scenario, imagine a client approaches you with a request to enhance their existing web application—a simple ToDo List app built with Java Spring Boot for the backend, PostgreSQL as the database, and ReactJS on the frontend, all deployed on Railway.
They want to upgrade the app with features commonly found in production-ready systems:
✅ Email verification upon signup
✅ User profile management (with profile picture upload)
✅ "Forgot Password" functionality with email recovery
This enhancement transforms a basic CRUD app into a more secure and user-friendly system, bringing it closer to the standards of modern web applications.
This is a great learning opportunity for aspiring full-stack developers, especially those who already know Java and are looking to gain practical experience building full authentication and profile systems. By working through this upgrade, you’ll get hands-on experience in:
-
Managing authentication and email flows in Spring Boot
-
Handling file uploads and user profile data
-
Building dynamic forms and secure access in ReactJS
-
Integrating email services and password recovery flows
Let’s walk through how to implement these features step-by-step and turn a simple ToDo app into a more complete web solution.
This is the high level specification:
Project Enhancement Request:
I have an existing full-stack ToDo List web application built with:
-
Backend: Java Spring Boot
-
Database: PostgreSQL
-
Frontend: ReactJS
-
Deployment: Railway
I would like to enhance the application with the following user account management features:
π Email Verification on Sign Up
-
After a user signs up, an email containing a verification link or code should be sent to their registered email.
-
Users cannot log in until they have verified their email.
-
The backend should securely store an email verification status (e.g., a
verified
boolean field) and update it upon verification. -
Token or link should expire after a certain duration (e.g., 24 hours).
π€ User Profile Page
-
Once logged in, users should have access to a Profile page where they can:
-
Upload and update a profile picture
-
Edit their first name, last name, address, and other personal information
-
-
Profile picture storage can use:
-
Railway's storage (if available), or
-
Cloud storage (e.g., Cloudinary, S3) with URL saved in the database
-
-
Ensure that updates are reflected immediately on the UI after saving.
π Login Screen with "Forgot Password" Feature
-
Add a "Forgot Password" link to the login screen.
-
Users can input their registered email, and the system will:
-
Send a password reset link or one-time code
-
Allow the user to reset their password securely via a new page or form
-
-
Expire password reset tokens after a short time (e.g., 15–30 minutes)
π Notes
-
All features must be fully integrated with the existing PostgreSQL user table schema, possibly adding new columns:
-
email_verified
,verification_token
,reset_password_token
,profile_picture_url
,first_name
,last_name
,address
-
-
Use Spring Security and JWT (if already in use) to manage secure access.
-
For sending emails, integrate a service like SendGrid, Mailgun, or SMTP (e.g., Gmail SMTP for testing).
✅ Feature Set
-
Email Verification on Signup
-
User Profile Page
-
Forgot Password Functionality
π§ Backend (Spring Boot + PostgreSQL)
1. User Entity Enhancements
Update the User
model:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | @Entity public class User { @Id @GeneratedValue private Long id; private String email; private String password; private boolean emailVerified = false; private String firstName; private String lastName; private String address; private String profileImageUrl; private String verificationToken; private String resetPasswordToken; private LocalDateTime tokenExpiry; // getters, setters } |
2. Signup + Email Verification Flow
-
On signup:
-
Generate a
UUID
verification token -
Send a verification email with a link:
https://your-app.com/verify?token=...
-
Save token and expiry in DB
-
Controller logic:
1 2 3 4 5 | @PostMapping("/signup") public ResponseEntity<?> register(@RequestBody SignupDTO dto) { // Save user with emailVerified = false // Generate token, send email using MailService } |
No comments:
Post a Comment