Skip to content

ENHANCEMENT: Externalize hardcoded email domains into configuration #26

Description

@Senthil455

Description

Student email domains (@student.annauniv.edu) and faculty email domains (@faculty.annauniv.edu) are hardcoded in app.py. This makes the application institution-specific and prevents easy deployment for other educational organizations.

Location

app.py:37-39

if not (email.endswith('@student.annauniv.edu') or email.endswith('@faculty.annauniv.edu')):
    flash('Only @student.annauniv.edu and @faculty.annauniv.edu emails are allowed!', 'danger')
    return redirect(url_for('register'))

Impact

  • Cannot deploy for other institutions without modifying source code
  • Forking requires code changes to use different domains
  • Configuration should be externalized for flexibility

Recommended Enhancement

  1. Move domains to environment variables:

    STUDENT_EMAIL_DOMAIN = os.environ.get('STUDENT_EMAIL_DOMAIN', '@student.annauniv.edu')
    FACULTY_EMAIL_DOMAIN = os.environ.get('FACULTY_EMAIL_DOMAIN', '@faculty.annauniv.edu')
    ALLOWED_DOMAINS = os.environ.get('ALLOWED_DOMAINS', '').split(',') or [
        STUDENT_EMAIL_DOMAIN,
        FACULTY_EMAIL_DOMAIN
    ]
  2. Update the validation to use configurable domains:

    if not any(email.endswith(domain) for domain in ALLOWED_DOMAINS):
        flash(f'Only emails from {", ".join(ALLOWED_DOMAINS)} are allowed!', 'danger')
        return redirect(url_for('register'))
  3. Allow administrators to configure allowed domains through an admin settings page

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions