A Flask web application with a dynamic login page that serves both students attempting examinations and administrators managing the system.
- Dynamic Login: Single login page for both students and administrators
- Role-based Access: Different dashboards based on user role
- Secure Authentication: Password hashing for security
- Responsive Design: Works on desktop and mobile devices
- Username:
student1, Password:student123 - Username:
student2, Password:student123
- Username:
admin, Password:admin123
/workspace/
├── app/
│ ├── app.py # Main Flask application
│ ├── templates/ # HTML templates
│ │ ├── login.html # Login page
│ │ ├── student_dashboard.html # Student dashboard
│ │ └── admin_dashboard.html # Admin dashboard
│ └── static/
│ └── css/
│ └── style.css # Styling
├── requirements.txt # Python dependencies
└── run.sh # Script to run the application
- Install dependencies:
pip install -r requirements.txt- Run the application:
./run.shOr alternatively:
cd app
python app.py- Open your browser and navigate to
http://127.0.0.1:5000
- Login Page: Users select their role (Student/Admin) and enter credentials
- Student Dashboard: Students can view available exams, results, and manage profile
- Admin Dashboard: Administrators can manage students, exams, view results, and system settings
- Session Management: Secure session handling with role-based redirects
- Logout Feature: Secure logout functionality
- Passwords are securely hashed using Werkzeug's security functions
- Session-based authentication
- Role validation on protected routes
- Input validation on login form
To add more students or administrators, modify the dictionaries in app.py:
students = {
'student1': {
'username': 'student1',
'password': generate_password_hash('student123'),
'name': 'John Doe',
'email': 'john@example.com',
'role': 'student'
},
# Add more students here
}
admins = {
'admin': {
'username': 'admin',
'password': generate_password_hash('admin123'),
'name': 'Admin User',
'role': 'admin'
},
# Add more admins here
}