Skip to main content

token based matrix registration app

Project description

Build Status Coverage Status PyPI - Python Version PyPI Matrix

matrix-registration

a simple python application to have a token based matrix registration

if you like me encountered the situation where you want to invite your friends to your homeserver, but neither wanted to open up public registration nor create accounts for every individual user yourself, this project should be the solution.

with this project you can just quickly generate tokens on the fly and share them with your friends to allow them to register to your homeserver.

setup

pip3 install matrix-registration
matrix-registration

INFO:

  • This only asks you for the most important options. You should definitely take a look at the actual configuration file.
  • The shared_secret has to be the same as registration_shared_secret in your homeserver.yaml

nginx reverse-proxy

an example nginx setup:

location  ~ ^/(static|register) {
        proxy_pass http://localhost:5000;
}

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

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 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

or by visiting http://localhost:5000/register?token=DoubleWizardSki

resources

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

troubleshooting

SQLAlchemy complains that a value isn't in a DateTime value

Before #17 introduced SQLAlchemy support the sqlite database incorrectly stored the expire dates, to fix this you have to manually run:

update tokens set ex_date=null where ex_date='None';

on your database once, or just delete your current database.

similar projects

For more info check the wiki

Project details


Download files

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

Files for matrix-registration, version 0.8.0
Filename, size File type Python version Upload date Hashes
Filename, size matrix_registration-0.8.0-py3-none-any.whl (585.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page