fix(spotweb): Add validation to user information (#1645)
* Add validation to username, firstname and lastname * Add email validation * Bump version number * Add validation.md to docs + fix unescaped char in email regex * Remove comments from questions.yaml
This commit is contained in:
@@ -84,7 +84,8 @@ questions:
|
|||||||
description: "Username to configure for the admin of this installation."
|
description: "Username to configure for the admin of this installation."
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: "admin"
|
default: "myawesomeuser"
|
||||||
|
valid_chars: ^((?!god|mod|spot|admin|drazix|superuser|supervisor|root|anonymous)[^<>])*$
|
||||||
required: true
|
required: true
|
||||||
- variable: SPOTWEB_PASSWORD
|
- variable: SPOTWEB_PASSWORD
|
||||||
label: "Admin password"
|
label: "Admin password"
|
||||||
@@ -123,6 +124,7 @@ questions:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
default: "firstname"
|
default: "firstname"
|
||||||
|
valid_chars: ^([^<>]{2})([^<>]*)$
|
||||||
- variable: SPOTWEB_LASTNAME
|
- variable: SPOTWEB_LASTNAME
|
||||||
label: "Admin last name"
|
label: "Admin last name"
|
||||||
description: "Last name of the admin user."
|
description: "Last name of the admin user."
|
||||||
@@ -130,6 +132,7 @@ questions:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
default: "lastname"
|
default: "lastname"
|
||||||
|
valid_chars: ^([^<>]{2})([^<>]*)$
|
||||||
- variable: SPOTWEB_MAIL
|
- variable: SPOTWEB_MAIL
|
||||||
label: "Admin mail adres"
|
label: "Admin mail adres"
|
||||||
description: "Email adres to configure for the provided admin user."
|
description: "Email adres to configure for the provided admin user."
|
||||||
@@ -137,6 +140,7 @@ questions:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
default: firstname@lastname.com
|
default: firstname@lastname.com
|
||||||
|
valid_chars: ^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
|
||||||
- variable: SPOTWEB_RETRIEVE
|
- variable: SPOTWEB_RETRIEVE
|
||||||
label: "SPOTWEB_RETRIEVE"
|
label: "SPOTWEB_RETRIEVE"
|
||||||
description: "Schedule on which to automatically retrieve new spots."
|
description: "Schedule on which to automatically retrieve new spots."
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Input Validation
|
||||||
|
|
||||||
|
## Admin Username
|
||||||
|
|
||||||
|
Usernames for an administrator in spotweb have some restrictions.
|
||||||
|
|
||||||
|
* Following words are not allowed:
|
||||||
|
* god
|
||||||
|
* mod
|
||||||
|
* spot
|
||||||
|
* admin
|
||||||
|
* drazix
|
||||||
|
* superuser
|
||||||
|
* supervisor
|
||||||
|
* root
|
||||||
|
* anonymous
|
||||||
|
* Following characters are not allowed:
|
||||||
|
* <
|
||||||
|
* \>
|
||||||
|
* Regex used to validate the username (you can try live [here](https://regex101.com/r/LA4Io7/1)):
|
||||||
|
`^((?!god|mod|spot|admin|drazix|superuser|supervisor|root|anonymous)[^<>])*$`
|
||||||
|
|
||||||
|
## Admin Firstname and Lastname
|
||||||
|
|
||||||
|
The firstname and lastname in spotweb have some restrictions.
|
||||||
|
|
||||||
|
* Following characters are not allowed:
|
||||||
|
* <
|
||||||
|
* \>
|
||||||
|
* Minimum lenght of 2 characters is enforced
|
||||||
|
* Regex used to validate the firstname and lastname (you can try live [here](https://regex101.com/r/x2KGnU/1)):
|
||||||
|
`^([^<>]{2})([^<>]*)$`
|
||||||
|
|
||||||
|
## Admin Email
|
||||||
|
|
||||||
|
The email addres is validated in spotweb using the built-in `_FILTER_VALIDATE_EMAIL`.
|
||||||
|
|
||||||
|
* Regex used to validate the email (you can try live [here](https://regex101.com/r/yEmCoL/1)):
|
||||||
|
```^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$```
|
||||||
|
|
||||||
|
---
|
||||||
|
If you find a field that you think it needs validation, please open an issue on github
|
||||||
Reference in New Issue
Block a user