Skip to main content

A Django app for allowing users to register for a Synapse account.

Project description

Synapse Matrix Registration System

This is a user registration system for a Matrix server using Django and the Synapse Admin API. It handles user sign-ups, admin approvals, and account management.

Features

  • User Registration Workflow: A step-by-step registration process, including username checking, email verification, and submission of a reason for registration.
  • Admin Approval: Registrations require admin approval before activation.
  • User Notifications: Email notifications are sent throughout the registration process to ensure users and admins remain informed.
  • Admin Portal: Admins can manage registrations directly from the Django admin interface, approving or denying requests.

Installation

  1. Clone the Repository:
git clone https://git.private.coffee/PrivateCoffee/synapse-registration.git
cd synapse-registration
python3 -m venv venv
source venv/bin/activate
pip install .
  1. Create configuration file:
cp config.dist.yaml config.yaml
  1. Edit configuration file:

Edit the config.yaml file to match your Matrix server and email settings.

The following settings are available:

  • debug: Set to true to enable Django debug mode. Do not enable in production.
  • secret_key: Django secret key. If not set, a random key will be generated on startup.
  • synapse: Synapse server settings.
    • admin_token: Access token of an admin user.
    • server: Synapse server URL (e.g. https://matrix.example.com).
    • domain: Matrix server domain (e.g. example.com).
    • verify_cert: If your Synapse server uses a self-signed certificate, set this to false, or provide the path to your CA bundle.
  • hosts: List of domains that the registration system will be accessible at. At least one domain is required.
  • email: Email server settings.
    • host: SMTP server hostname. Required.
    • port: SMTP server port. Required.
    • username: SMTP username. Required.
    • password: SMTP password. Required.
    • tls: Set to true to enable STARTTLS.
    • ssl: Set to true to enable SSL.
    • from: Email address to send notifications from. Defaults to the username setting.
  • admin: Admin user settings.
    • email: Email address to send admin notifications to. Required.
  • trust_proxy: Set to true if the registration system is behind a reverse proxy. This ensures the correct IP address is logged.
  • auto_join: Optional list of rooms to automatically join users to after registration. The admin user must be in these rooms and have invite permissions.
  • legal: Optional list of legal documents to link to in the registration form. Each item must have a title and url.
  • retention: Optional retention periods for registrations.
    • started: Days to keep unverified registrations. Default is 2 days.
    • completed: Days to keep completed/denied registrations. Default is 30 days.
  • database: Optional database settings.
    • path: Path to the SQLite database file. Defaults to db.sqlite3 in the current directory.
  1. Run migrations:
synapse_registration migrate
  1. Create superuser:
synapse_registration createsuperuser
  1. Run the server:

For development:

synapse_registration runserver

For production, use a WSGI server such as uWSGI, behind a reverse proxy such as Caddy.

Usage

  1. Access the registration system:

Navigate to the domain you set in the config.yaml file. You should see the registration form.

  1. Register a new user:

The registration process is as follows:

  • Step 1: Enter a username. The system will check if the username is available.
  • Step 2: Enter an email address. A verification email will be sent.
  • Step 3: Enter a password and reason for registration. The password will be stored in Synapse, the reason will be stored in the admin interface.
  • Step 4: Wait for an admin to approve the registration. You will receive an email when this happens.
  1. Approve a registration:
  • Step 1: Log in to the Django admin interface.
  • Step 2: Navigate to the User registrations section.
  • Step 3: Review the registration request and set the status to Approved or Denied. This will enable the Matrix account and send an email to the user.
  1. Clean up registrations:

Note: This is no longer necessary. Old registrations are automatically cleaned up.

You can use the synapse_registration cleanup command to remove old registration requests.

  • Unverified registrations are removed after 48 hours.
  • Denied and approved registrations are removed after 30 days.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synapse_registration-0.1.3.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synapse_registration-0.1.3-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file synapse_registration-0.1.3.tar.gz.

File metadata

  • Download URL: synapse_registration-0.1.3.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for synapse_registration-0.1.3.tar.gz
Algorithm Hash digest
SHA256 58b754b99ec71fae9c5d61d483ec7bc663c78852b12104045e1914def4fc265f
MD5 2c8c335566b32e0ecd14578980022bc7
BLAKE2b-256 c918bfa803123e7ebdaf375aa8b17d54ff6c7c9f313fded1a3163699b81d0f57

See more details on using hashes here.

File details

Details for the file synapse_registration-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for synapse_registration-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e3918cbdcf78f72d92565e62677740d441fcd0ed201e399a48564c2e8ef05d19
MD5 ec629cb37f447a18a9f1614cd66d200c
BLAKE2b-256 c23a9a3a8b59989b1bccd7e7e8e95357d48da2d2b7e9d7262576b78bf44dc7be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page