基于令牌的矩阵注册应用
matrix-registration的Python项目详细描述
矩阵注册
一个简单的python应用程序,具有基于令牌的矩阵注册
如果你像我一样遇到这样的情况,你想邀请你的朋友到你的家庭服务器,但既不想公开注册,也不想为每个用户自己创建帐户,这个项目应该是解决方案。
有了这个项目,你可以快速生成令牌,并与你的朋友分享,让他们注册到你的主服务器。
设置
pip3 install matrix_registration python -m matrix_registration
info:这只要求您提供最重要的选项。 你应该看看实际的配置文件。
要查看配置的存储位置,请执行以下操作:
python -m matrix_registration config
nginx反向代理
nginx设置示例:
location~^/(static|register){proxy_passhttp://localhost:5000;}
如果您已经有了一个网站,并且想要使用自己的注册页,wiki描述了一个更高级的nginx设置。
用法
$ python -m matrix_registration -h usage: python -m matrix_registration [-h]{api,gen,status,config} ... a token based matrix registration app positional arguments: {api,gen,status,config} sub-commands. for ex. 'gen -h'for additional help api start as api gen generate new token. -o onetime, -e expire date status view status or disable token. -s status, -d disable, -l list config show config location optional arguments: -h, --help show this help message and exit
启动api服务器和generated a token之后,您可以使用一个简单的post请求注册一个帐户,例如:
curl -X POST \ -F 'username=test'\ -F 'password=verysecure'\ -F 'confirm=verysecure'\ -F 'token=DoubleWizardSki'\ http://localhost:5000/register
或者通过访问http://localhost:5000/register?token=DoubleWizardSki
资源
如果您想编写自己的注册页,可以在resources/example.html中查看示例
html页面查找查询参数token
,并将令牌输入字段设置为其值。这将允许您直接与包含的令牌共享链接,例如:
https://homeserver.tld/register.html?token=DoubleWizardSki
有关详细信息,请查看wiki