Skip to main content

token based matrix registration app

Project description

Build Status Coverage Status Translation status PyPI - Python Version PyPI Matrix

matrix-registration

A simple Python application enabling token-based registration for matrix servers.

You may have, like me, encountered the situation where you want to invite your friends to create an account on your homeserver, but neither want to open up public registration nor create accounts for every individual user yourself. This project aims to solve this problem.

With matrix-registration, you can quickly generate tokens on the fly and share them with your friends to allow them to register on your homeserver.

Setup

Install using pip:

pip3 install matrix-registration

or check the docker guide

First start

To start, execute matrix-registration.

A configuration file should be generated for you on first start.

If this fails...

you can create a configuration for your matrix homeserver by copying config.sample.yaml to your server and editing it:

wget https://raw.githubusercontent.com/ZerataX/matrix-registration/master/config.sample.yaml
cp config.sample.yaml config.yaml
nano config.yaml

Then pass the path to this configuration to the application on startup using --config-path /path/to/config.yaml.

INFO:

  • This only asks you for the most important options. You should definitely take a look at the actual configuration file. The path to the file will be printed by matrix-registration the first time it runs.

Usage

$ matrix-registration -h
Usage: matrix-registration [OPTIONS] COMMAND [ARGS]...

  a token based matrix registration app

Options:
  --config-path TEXT  specifies the config file to be used
  --version           Show the flask version
  -h, --help          Show this message and exit.

Commands:
  generate  generate new token
  serve     start api server
  status    view status or disable

After you've started the API server and generated a token you can register an account either:

  • with a simple post request, e.g.:
curl -X POST \
     -F 'username=test' \
     -F 'password=verysecure' \
     -F 'confirm=verysecure' \
     -F 'token=DoubleWizardSki' \
     http://localhost:5000/register

Further Resources

Nginx reverse-proxy

If you'd like to run matrix-registration behind a reverse-proxy, here is an example nginx setup:

location  ~ ^/(static|register) {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://localhost:5000;
}

Custom registration page

If you want to write your own registration page, you can take a look at the sample in resources/example.html

The html page looks for the query paramater token and sets the token input field to it's value. this would allow you to directly share links with the token included, e.g.:

https://homeserver.tld/register.html?token=DoubleWizardSki

If you already have a website and want to use your own register page, the wiki describes a more advanced nginx setup.

bot

if you're looking for a bot to interface with matrix-registration and manage your tokens, take a look at:

maubot-invite

Similar projects

For more info check the wiki

Artwork attribution

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

matrix_registration-0.9.1.post1-py3-none-any.whl (614.0 kB view details)

Uploaded Python 3

File details

Details for the file matrix_registration-0.9.1.post1-py3-none-any.whl.

File metadata

  • Download URL: matrix_registration-0.9.1.post1-py3-none-any.whl
  • Upload date:
  • Size: 614.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20210325 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.10

File hashes

Hashes for matrix_registration-0.9.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7d2386e7164bba3f5ec9deee6838eb2ff64a0de61aeca62a019a4496bbe7277
MD5 93587635ca9ad5a1cdb2082a51e3b45f
BLAKE2b-256 75e03083b8f193ad5aef4fc1473a742d980c9ca7dc1dc64512b4d2dfaeb05c2c

See more details on using hashes here.

Supported by

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