Compare commits
4 Commits
f49f6cef73
...
dda0e83abe
| Author | SHA1 | Date | |
|---|---|---|---|
| dda0e83abe | |||
| 21e20e87cb | |||
|
|
3eccf446d6 | ||
| 3fa2a2fe03 |
@@ -1,4 +1,6 @@
|
|||||||
# matrix-register-bot
|
# matrix-register-bot
|
||||||
|

|
||||||
|
[](https://matrix.to/#/#matrix-register-bot:msg-net.de)
|
||||||
|
|
||||||
This bot provides a two-step-registration for matrix ([synapse](https://github.com/matrix-org/synapse)).
|
This bot provides a two-step-registration for matrix ([synapse](https://github.com/matrix-org/synapse)).
|
||||||
|
|
||||||
@@ -16,7 +18,7 @@ To configure synapse so that the users can login that were created via this bot
|
|||||||
- set `operationMode=synapse` so the bot uses the register api to push the new users to synapse or
|
- set `operationMode=synapse` so the bot uses the register api to push the new users to synapse or
|
||||||
- integrate it via [matrix-synapse-rest-auth](https://github.com/kamax-io/matrix-synapse-rest-auth#integrate) by configuring your system to point at `internal/login.php`.
|
- integrate it via [matrix-synapse-rest-auth](https://github.com/kamax-io/matrix-synapse-rest-auth#integrate) by configuring your system to point at `internal/login.php`.
|
||||||
|
|
||||||
When using `operationMode=local` you can have the following benefits (some require [mxisd](https://github.com/kamax-io/mxisd/blob/master/docs/backends/rest.md))
|
When using `operationMode=local` you can have the following benefits (some require [mxisd](https://github.com/kamax-io/mxisd/blob/master/docs/stores/rest.md))
|
||||||
- Automatically set the display name based on first and last name on first login
|
- Automatically set the display name based on first and last name on first login
|
||||||
- Use the 3PID lookup for other users (only email)
|
- Use the 3PID lookup for other users (only email)
|
||||||
- Search for users that you have not seen yet
|
- Search for users that you have not seen yet
|
||||||
@@ -28,7 +30,7 @@ When using `operationMode=local` you can have the following benefits (some requi
|
|||||||
The folder `internal` contains files that only provide API access. They can be accessed by mxisd or matrix-synapse-rest-auth
|
The folder `internal` contains files that only provide API access. They can be accessed by mxisd or matrix-synapse-rest-auth
|
||||||
- To integrate with [matrix-synapse-rest-auth](https://github.com/kamax-io/matrix-synapse-rest-auth):
|
- To integrate with [matrix-synapse-rest-auth](https://github.com/kamax-io/matrix-synapse-rest-auth):
|
||||||
- `/_matrix-internal/identity/v1/check_credentials` should map to `internal/login.php`
|
- `/_matrix-internal/identity/v1/check_credentials` should map to `internal/login.php`
|
||||||
- To integrate with [mxisd](https://github.com/kamax-io/mxisd): Have a look at [the docs of mxisd](https://github.com/kamax-io/mxisd/blob/master/docs/backends/rest.md) and apply as follows:
|
- To integrate with [mxisd](https://github.com/kamax-io/mxisd): Have a look at [the docs of mxisd](https://github.com/kamax-io/mxisd/blob/master/docs/stores/rest.md) and apply as follows:
|
||||||
|
|
||||||
|
|
||||||
| Key | file which handles that | Description |
|
| Key | file which handles that | Description |
|
||||||
@@ -58,6 +60,3 @@ Here is an example for nginx:
|
|||||||
### The bot postpones some actions
|
### The bot postpones some actions
|
||||||
There is a cron.php which implements retries and database cleanups (e.g. to remove a username claim)
|
There is a cron.php which implements retries and database cleanups (e.g. to remove a username claim)
|
||||||
For this run cron.php regularly with your system of choice.
|
For this run cron.php regularly with your system of choice.
|
||||||
|
|
||||||
### Chat
|
|
||||||
For further questions, comments, feedback and more come and talk in [#matrix-register-bot:msg-net.de](https://matrix.to/#/#matrix-register-bot:msg-net.de)
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $language = array(
|
|||||||
"UNKNOWN_SESSION" => "Sitzungstoken nicht vorhanden oder ungültig.",
|
"UNKNOWN_SESSION" => "Sitzungstoken nicht vorhanden oder ungültig.",
|
||||||
"UNKNOWN_USERNAME" => "Nutzername fehlt",
|
"UNKNOWN_USERNAME" => "Nutzername fehlt",
|
||||||
"UNKNOWN_TOKEN" => "Token ist unbekannt",
|
"UNKNOWN_TOKEN" => "Token ist unbekannt",
|
||||||
"USERNAME_LENGTH_INVALID" => "Entweder mehr als 20 oder weniger als 3 Zeichen für den Nutzernamen verwendet",
|
"USERNAME_INVALID" => "Nutzername muss aus 3 bis 20 Kleinbuchstaben bestehen",
|
||||||
"USERNAME_NOT_ALNUM" => "Nutzername ist nicht alphanumerisch",
|
"USERNAME_NOT_ALNUM" => "Nutzername ist nicht alphanumerisch",
|
||||||
"USERNAME_PENDING_REGISTRATION" => "Dieser Nutzername wurde bereits zur Registrierung vorgemerkt. Versuche es später noch einmal oder wähle einen anderen Nutzernamen",
|
"USERNAME_PENDING_REGISTRATION" => "Dieser Nutzername wurde bereits zur Registrierung vorgemerkt. Versuche es später noch einmal oder wähle einen anderen Nutzernamen",
|
||||||
"USERNAME_REGISTERED" => "Dieser Nutzername wurde bereits registriert. Bitte wähle einen anderen Nutzernamen",
|
"USERNAME_REGISTERED" => "Dieser Nutzername wurde bereits registriert. Bitte wähle einen anderen Nutzernamen",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $language = array(
|
|||||||
"UNKNOWN_SESSION" => "Session token not found of invalid.",
|
"UNKNOWN_SESSION" => "Session token not found of invalid.",
|
||||||
"UNKNOWN_USERNAME" => "username unknown",
|
"UNKNOWN_USERNAME" => "username unknown",
|
||||||
"UNKNOWN_TOKEN" => "Token is unknown",
|
"UNKNOWN_TOKEN" => "Token is unknown",
|
||||||
"USERNAME_LENGTH_INVALID" => "Username cpnsists pf more than 20 or less than 3 characters",
|
"USERNAME_INVALID" => "Username has to consist of 3 to 20 small letters",
|
||||||
"USERNAME_NOT_ALNUM" => "Username is not alphanumeric",
|
"USERNAME_NOT_ALNUM" => "Username is not alphanumeric",
|
||||||
"USERNAME_PENDING_REGISTRATION" => "This username is locked for registration. Try again later or try again with a different username",
|
"USERNAME_PENDING_REGISTRATION" => "This username is locked for registration. Try again later or try again with a different username",
|
||||||
"USERNAME_REGISTERED" => "This username is already registered. Please try again with another username",
|
"USERNAME_REGISTERED" => "This username is already registered. Please try again with another username",
|
||||||
|
|||||||
@@ -49,8 +49,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
if (!isset($_POST["username"])) {
|
if (!isset($_POST["username"])) {
|
||||||
throw new Exception("UNKNOWN_USERNAME");
|
throw new Exception("UNKNOWN_USERNAME");
|
||||||
}
|
}
|
||||||
if (strlen($_POST["username"] > 20 || strlen($_POST["username"]) < 3)) {
|
if (strlen($_POST["username"]) > 20 ||
|
||||||
throw new Exception("USERNAME_LENGTH_INVALID");
|
strlen($_POST["username"]) < 3 ||
|
||||||
|
!ctype_lower($_POST["username"])) {
|
||||||
|
throw new Exception("USERNAME_INVALID");
|
||||||
}
|
}
|
||||||
if (ctype_alnum($_POST['username']) != true) {
|
if (ctype_alnum($_POST['username']) != true) {
|
||||||
throw new Exception("USERNAME_NOT_ALNUM");
|
throw new Exception("USERNAME_NOT_ALNUM");
|
||||||
@@ -215,7 +217,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var user_name = document.getElementById("username");
|
var user_name = document.getElementById("username");
|
||||||
user_name.oninvalid = function (event) {
|
user_name.oninvalid = function (event) {
|
||||||
event.target.setCustomValidity("<?php echo $language["USERNAME_LENGTH_INVALID"]; ?>");
|
event.target.setCustomValidity("<?php echo $language["USERNAME_INVALID"]; ?>");
|
||||||
}
|
}
|
||||||
user_name.onkeyup = function (event) {
|
user_name.onkeyup = function (event) {
|
||||||
event.target.setCustomValidity("");
|
event.target.setCustomValidity("");
|
||||||
|
|||||||
Reference in New Issue
Block a user