~callum/mreg

Matrix registration by token
Generate links with the tokens in the URL
Move templates and static files to .example files

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~callum/mreg
read/write
git@git.sr.ht:~callum/mreg

You can also use your local clone with git send-email.

#mreg

This small Python Flask application lets people register on your Matrix server if they have a valid single-use token. This allows permitted people to register without enabling public registration. Inspired by matrix-registration, but with the aim of easier customisation.

Provided is a Flask app, example HTML templates, stylesheet and configuration file, and a CLI for generating, deleting and listing tokens. To see how to use the CLI do $ ./mreg.

Currently on Synpase is supported, and only using the register_new_matrix_user command provided by Synapse not the admin API. Hopefully more servers will be supported in future, or even better this kind of functionality will be integrated into matrix servers and clients.

#Setup using uWSGI, systemd and NGINX

You can deploy it however you like, this is provided for convenience.

First make sure your normal user is in www-data group so that you will be able to access the database file.

$ git clone https://git.sr.ht/~callum/mreg
$ cd mreg
$ ./copy-examples.sh

Adjust config.py to your needs.

$ ./mreg list
$ chmod 664 mreg/mreg.db
$ python -m venv venv
$ source venv/bin/activate
$ python -m pip install --upgrade pip
$ python -m pip install flask uwsgi
$ deactivate
# chown -R www-data: .
# cp mreg.service /etc/systemd/system/
# systemctl daemon-reload
# systemctl start mreg.service

Edit your NGINX site configuration file and add the following to a server block:

location /mreg { try_files $uri @mreg; }
location @mreg {
    include uwsgi_params;
    uwsgi_pass unix:/var/www/mreg/mreg.sock;
}